The need for static memory buffers allocated on initialization, I learned by necessity, coding games for Mac Classic, and Power Macintosh computers. I've since re-implemented (in 2012) for medical devices.
REQUIREMENT:
On the old Mac OS, if your application ran out of memory, you were out of luck, it crashed. This was Motorola processor days before Apple switched to their OSX and Intel system. Those old MACs gave you a fixed size memory buffer which you had to declare when your app was installed, and if there was not enough, the app did not run. You had to figure out by hand how much to ask for and hope it was available after any other apps were loaded and running on a user's computer.
On any system, if your app runs out of memory while running in real time, it can slow down while the memory manager is working to provide memory pages, or while the app is swapping around data to allocate more and more.
SOLUTION:
When your app initializes, allocate all the memory you might need right away, and from then on, minimize system allocations while running in real time.
IMPLEMENTATION:
Static heap allocations of fixed size, code checks that allocations fit in this static heap while running, and if not, it can re-allocate a larger heap (not desirable). Code to be provided.
WHY:
As always, if YOU control the code, you can make it work. If you rely on the OS, there is more in the 'black box' of uncertainty.
No comments:
Post a Comment