Hacker News new | ask | show | jobs
by tempodox 1924 days ago
You are correct. Resource objects had a `purgeable` bit that would allow the block to be evicted from RAM if memory became scarce. Also, the memory blocks for resources were allocated as `Handles` (essentially, `void **` instead of `void *`, as C malloc() would return). That made the blocks holding the data moveable in memory, for reducing heap fragmentation. If your Handle pointed to a NULL pointer, that meant the block was purged and needed to be reloaded from disk. Manual allocation could also be done as a Handle, further reducing the risk of heap fragmentation.