Shared pointers, memory management & allocators

> Coding, hacking, computer graphics, game dev, and such...
User avatar
fips
Site Admin
Posts: 166
Joined: Wed Nov 12, 2008 9:49 pm
Location: Prague
Contact:

Shared pointers, memory management & allocators

Post by fips »

I've been recently thinking about the right memory model for my latest game-related codebase and I've found this issue crucial when it comes to code reusability.

I'm not quite convinced that the obvious choice - Shared Pointers is the right way to go. The idea that the object ownership is spread across the system without explicit control isn't appealing to me anymore. Moreover, it seems to me now that really complex reusable data structures have to be free of the ownership management.

This thoughts bring me back to good old Raw Pointers!, however, combined with a custom allocator. The allocator would manage an underlying system of packages. So every new allocated object would be associated with a package, which would define object's lifetime.

FipS
Post Reply