#21 Handheld Crash - Memory Usage Issue


I'm experiencing a crash within clear_entire_board on the GP2X (Open2x toolchain). I can get it to clear up to 187 rows and then it gets killed -- the number of rows varies. This doesn't necessarily mean it's an issue with clear_entire_board or clear_field/create_object, likely there is some memory corruption from something elsewhere.

The Zaurus segfaults at the start. I can't even get a string printed to the terminal before the Zaurus segfaults! I don't understand that at all.

I'm now going to build a GP2X version using the standard GPH toolchain and see if that works.

I have noticed that the memory usage is 48756 kB on my desktop PC for a 320x240 window with 43192 kB of that being data! I can't remember what it used to be.


  • Thunor

    Thunor - 2010-08-30

    GP2X with GPH toolchain crashes through level_init so it's probably doing it in the same place.

    I did manage to dump the VMSize: 35016 kB.

    cat /proc/iomem reports:

    00000000-01ffffff : System RAM

    which is 32MB.

    "The RAM is 64MB, but split in 2 32MB sections. And the 2nd 32MB section has some parts that are always in use. Most games and emulators limit themself to 16MB (as a full part of 16MB memory is very easy to get as a programmer)."

    I think I'll recompile some older GNU Robbo versions and track the memory usage.

  • Thunor

    Thunor - 2010-08-30

    cat /proc/meminfo via Termula2x reports this:

    total: used: free: shared: buffers: cached:
    Mem: 31588352 17043456 14544896 0 1118208 10473472
    Swap: 0 0 0
    MemTotal: 30848 kB
    MemFree: 14204 kB
    MemShared: 0 kB
    Buffers: 1092 kB
    Cached: 10228 kB
    SwapCached: 0 kB
    Active: 3532 kB
    Inactive: 9684 kB
    HighTotal: 0 kB
    HighFree: 0 kB
    LowTotal: 30848 kB
    LowFree: 14204 kB
    SwapTotal: 0 kB
    SwapFree: 0 kB

  • Thunor

    Thunor - 2010-08-30

    GNU Robbo's Memory Usage

    0.62 0.64 0.65.6-1 0.66

    PC 19724 31340 31600 48756 KB

    GP2X 12260 17520 17836 35016 KB

    These values are for VmSize.

    So I guess I've solved the crashing, but I'm wondering where this extra 17MB is being used between 0.65.6-1 and 0.66 and whether it can be reduced so I can continue to port to handheld devices. 0.65.6-1 was revision 331. I think though that for me 0.65.6-1 was already at the limit and I was lucky that that version worked.

  • Thunor

    Thunor - 2010-08-30

    Ok, I've found it ;)

    r354 increased memory usage from 31564 kB to 48748 kB VmSize.


    MAX_ICONS was changed from 9 to 64. This is actually the maximum number of animation frames for an object, and should be 9 (WALL has 9 frames). It defines the maximum size of an object's icon coords array, so I guess 4 byte integer * 2 * 55 * 200 * 200 = 17MB.

    I think it's about time the 200 * 200 maximum board size was set to something more suitable. The max size the designer allows is 32x31 so I'll set it to that.

    Revised Memory Usage


    PC 25476 kB

    GP2X 11776 kB

    and it now works.

  • Thunor

    Thunor - 2010-08-30
    • summary: Handheld Crash --> Handheld Crash - Memory Usage Issue
  • Thunor

    Thunor - 2010-08-30
    • status: open --> open-fixed
  • Thunor

    Thunor - 2010-08-31
    • status: open-fixed --> closed-fixed

Log in to post a comment.