So this is mostly a theoretical question, as my current solution is "dynamically allocate everything on load and store void pointers", which is obviously subpar in every respect. Either way I need to do something. The only question is what.
I've been thinking about how to store resources I load in my game. I've got two competing ideas in my head, but I'm sure there are more:
1. Allocate by scene: I could create a special file format with all the scene data zipped up and a header that contains pertinent information (like uncompressed scene size). With this, I can load the entire file whenever I need a scene and block-allocate everything together. Unloading the scene would be easy -- just free the whole buffer. This has the benefit of being nice and compact, and I could mitigate a lot of load time by just prefetching scenes as the player goes through the game, which is great. On the other hand, it means all my data is grouped by scene, so linear traversals of things (like, say, for rendering) would be less than optimal, to put it nicely.
2. Allocate by type: Reserve a bunch of buffers for each type of resource I need and bucket on that. This has the benefit of leaving all of my data contiguous for fast traversal, but makes in-place sorting or deleting things impossible without index invalidation or some kind of lookup table (which defeats the purpose of making stuff contiguous in the first place). It's also wasteful since each buffer has to be as large as you could possibly fill, even if they're not taken simultaneously.
I'd like the benefits of both, honestly, but I know that's impossible. What do other games do? A mix and match of the two? Something more fine-grained, like a flag parameter telling where to put the data? I know of other allocators like memory pools, but I'm less sure how they're applied.
Are there any good resources for this sort of thing? The only thing I've seen to even touch on it is this book, but even that basically just touches on the different types of allocators out there.