Skip to content

Memory backend improvements

Alex requested to merge branch/mem-backend into branch/unified

The most important part from here is get_max_region (GetSizeOfMaxRegion), which should avoid ERR70 when AllocateMemory gets fragmented. Before, this was approximated by free_space/2. I've tweaked it to free_space/4, but it's still just a guess; using the current size of max region is much better.

I'd like to add this one on all other cameras, that's why I didn't do a config define, so I need some help with stubs.

Other fixes:

  • Concurency issues solved (currently running some burn-in tests with g3gg0's mem_chk module).

  • TCC hack: on 60D for example (which needs PLT/GOT trickery), when loading adtg_gui you get overflow. Figure out why.

  • Caching bits: just a small speed fix for modules that end up in shoot_malloc.

  • On low-memory cameras, temporary TCC memory now goes to shoot_malloc, so the final module code has a much higher change to end in the main buffers. Result: shoot_malloc is free even after loading the huge adtg_gui on 60D (a memory-hungry camera).

TODO: would be nice to add get_max_region to malloc too, but iirc that one doesn't throw err70 on failure, so it's not as important. However, the backend currently doesn't try a different allocator if the chosen one fails (desirable or not?)

Merge request reports

Loading