1100D Memory Backend

Issue #2259 new
David Milligan created an issue

Working on the lua stuff I noticed that my 1100D would crash if I loaded more than about 2 or 3 scripts. This issue appears to be due to the memory backend (lua uses a fair amount of memory). The crash seems to happen when the malloc allocator runs out of memory. Watching the free memory page, malloc drops down to ~64k remaining then the crash happens. No log or anything, just a hard freeze, though one time (out of say maybe 20 times) I did get an err70 right before the hard freeze.

On my 60D everything works as expected, malloc starts getting used up, then when malloc is almost gone, the allocations start coming from AllocateMemory and everything continues on fine using memory from AllocateMemory.

Comments (5)

  1. Alex

    You can get a log of what's going on by defining MEM_DEBUG in mem.c and CONSOLE_DEBUG in console.c. It will be saved in ML/LOGS/console.log.

    Did you get any crash log along with the err70?

  2. David Milligan reporter

    no crash log with the err70, I will work on the mem debug log, I actually did define MEM_DEBUG to see if I saw anything, but I didn't have it log to a file, so I'll work on that

  3. Alex

    There seem to be errors from the beginning. Many happen in realloc, which doesn't check for valid pointers.

    Would be nice to reproduce the error in QEMU.

  4. Alex

    Boo, no such errors in QEMU. Sure, that one does not emulate all memory backends, just malloc and AllocateMemory, and there's a lot of free space in them compared to what you get on the camera (that's because most Canon tasks fail to start). I tried to allocate some gibberish at camera startup, and after loading all the stuff, free memory is 183K+751K. If I allocate a few KB more at startup, I get a clean error message:

    Load modules...
      [i] load: LUA.MO
    ML/MODULES/LUA.MO: error: memory full

    The demo scripts appear to work fine in the emulator.

  5. Log in to comment