Shop OBEX P1 Docs P2 Docs Learn Events
runtime memory limit exceeded ? — Parallax Forums

runtime memory limit exceeded ?

janbjanb Posts: 74
edited 2008-06-10 07:26 in Propeller 1
Hi,
I put together to working examples and got error:
runtime memory limit exceeded by 745 longs

Example 1 compiled (and worked) fine. F8 reported:
prog=1504 long,
var = 508 long
free= 6170 long

Similar benchmark for Example 2

I was expecting that if code from both is merged I'd still get ~4000 free words.

Somehow 5+5=30 [noparse]:)[/noparse]

I have attached full code. It is enough to disable constructor for the 'kal' object (marked ***HERE***) to make the code fit in to memory.
But I need this object.

Perhaps someone sees a simple way to adjust my code so it fits in to Propeller?
Thanks
Jan

Comments

  • rjo_rjo_ Posts: 1,825
    edited 2008-06-06 02:03
    I seem to remember that the DAT sections don't get tabulated... your DAT section is nice and tidy, but the graphics objects use a lot of DAT declarations...

    You could use a different display or a smaller graphics object.

    Nice app.

    Are you planning to put the Prop on the same board?

    Can I buy one?

    Post Edited (rjo_) : 6/6/2008 2:12:56 AM GMT
  • janbjanb Posts: 74
    edited 2008-06-06 03:36
    Hi rjo_
    could you recommend 'a different display or a smaller graphics object' I could try?
    Jan
  • rjo_rjo_ Posts: 1,825
    edited 2008-06-06 14:47
    I sound like a shill for 4D... but any of their products have a small software footprint...

    with regard to graphics objects... we have the experts available... and I would probably get it wrong.
  • rjo_rjo_ Posts: 1,825
    edited 2008-06-06 14:51
    Your code looks pretty good... so I'm optimistic that if you haven't solved this already you are about to...

    BUT just in case you run into a wall and you want to change as little as possible, why not use a dedicated Prop for sensing and talk to your graphics prop over serial?
  • ClemensClemens Posts: 236
    edited 2008-06-06 17:44
    maybe you can throw out tv_text.spin and display your text with the graphics driver.
    Steven did a version of the graphic driver that displays smaller text:

    http://forums.parallax.com/showthread.php?p=707333

    I don't know if this helps, but it was worth a try...
  • janbjanb Posts: 74
    edited 2008-06-07 15:56
    Hi,
    Indeed after digging around on this forum I found out people were suggesting to scarify double buffering of the screen for more code space.
    So I replaced :
     _stack = ($3000 + $3000 + 100) >> 2   
      bitmap_base = $2000
      display_base = $5000
      .....
      gr.setup(16, 12, 20, 20, bitmap_base)
    
    



    with :

     _stack = ($3000 + 100) >> 2 
      display_base = $5000
      ......
      gr.setup(16, 12, 20, 20, display_base)
    
    



    and now I can add many more objects to my project and it still compiles.

    But ... I'm nots sure I understand fully what I did. Could you confirm this change is optimal?
    Could I 'recover' more propeller resources by using different values instead of $3000 & $5000 ?
    I'd like to keep the screen resolution and not change the tailing 16x12
    Thanks
    Jan
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-06-10 07:26
    Why are you using tv_text and graphics?

    If you want to get rid of the double buffer what you have done is fine. you can also get rid of any gr.copys that are in your code. The double buffer simply works by drawing to an offscreen buffer and then copying everything over when you tell it to. For graphics to work the bitmaps need to be aligned on 64 byte boundaries. The easiest way to do this is to simple put them at the end of the memory which is where the $5000 comes from.

    Depending on how much stuff you are drawing the screen will start to flicker. If you have a look at the XOR object in the the thread Clemens mentioned it has a demo that should help to stop that.
Sign In or Register to comment.