Hacker News new | ask | show | jobs
by buserror 3543 days ago
Classic MacOS dealt with the memory fragmentation in a pretty neat way tho. All code was relocatable to start with, and pretty much every memory block you'd allocate was also relocatable by using one further level of indirection called a Handle. A Handle was basically a pointer to a pointer. A Handle defaulted to 'unlocked' so the actual memory block could move at any time; unless you Locked it, and Unlocked it afterward.

This allowed the OS to compact the memory heap, move all the relocatable blocks in one corner and allow further contiguous blocks to be allocated.

Of course, this is a primitive concept these days, but it allowed amazing pieces of software to exist on very, very small memory systems.

2 comments

Handles were effectively a brilliant workaround at the time, given the constraints of having static memory allocation for apps.

(This kindles some fond memories of MacOS classic development along with the Inside Macintosh books...)

I fondly remember playing with Photoshop 2.5 on my Color Classic with its 16MHz CPU with 10MB RAM... It was amazing what you could do on such a "primitive" machine.
Photoshop was a little bit of a masterpiece back then (it arguably still is, deep down) -- it had it's own 'swap' system for large pixmaps that allowed you to work on images that were massively bigger than the onboard memory; and it wasn't even that slow (unless you were applying filters on the whole image).