I have hit the dreaded 'out of memory error'. My app takes 57K even just showing the initial menu. The app has a very small amount of global data so most of this 57K is code.
The structure of the app, like many I suspect, is a hierarchical series of menus that configure the global data to be used when the activity (sailing in my case) starts. Many of the menus cover optional items so may not be invoked at all, or maybe just once when configuring how the activity is gong to run. All the menus and associated code form part of the memory footprint, as would be expected.
My understanding of resources is they are not part of the apps memory footprint until they are loaded and the memory is recovered when they go out of scope or are explicitly freed by setting the resource reference to null. If code could be stored as a resource and loaded, run and freed under program control then this would be one way to extend the app without exceeding its memory footprint. Code overlays are not a new idea and would obviously need some restriction on how they interact with the system (only one level of overlays) and the rest on the app (just access global data).
If the amount of memory an app is allocated is based on some arbitrary decision and not fixed by some hardware limit then the best solution is to increase it :-) but failing that code overlays provide a solution.
I am not expecting an app's memory size to be increased or code overlays implemented anytime soon, but just mentioning them as possible future options.
I will need to spend some time looking at the assembler output and debug information to understand where the space is going to direct some optimisation work. I am sure I can make some improvements, but even so it is disappointing to have to drop some planned features.
Dave.