This patch (to trunk 665) makes CHDK free RAM reserved for Zebra
#1 before a script is run
#2 if zebra shortcut key is pressed to disable zebra
#3 after half shoot is released
It does not release Zebra RAM if zebra is disabled from the Zebra menu, because I didn't know how to do that.
I think #3 probably makes #1 and #2 unnecessary, but I'm not sure if it's a good idea to be mallocing and freeing zebra RAM each half-shoot. It seems to work well, but I didn't do any benchmarks!
It would be nice because then some other memory-hog (like edge overlay) would start correctly even if zebra is enabled, and zebra would just fail to draw if there's not enough RAM for both. But then again with RAM being released instantly it will be harder to notice while debugging other things that a random crash was due low RAM. Alternatively, memory hogging parts of code (like edge overlay) could attempt to release zebra RAM at startup. I already did this for script startup.
This #3 can be disabled by removing a few lines from the very end of the diff:
@@ -2601,6 +2603,7 @@
if (!kbd_is_key_pressed(KEY_SHOOT_HALF)) {
zebra = 0;
draw_restore();
+ gui_osd_zebra_free_memory();
}
return;
}
So what do people think? How should it be done?