Jump to content
Site Stability Read more... ×
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Fun with memory

Sign in to follow this  


Today I experimented with a C++ per class allocator scheme. As I mentioned earlier, I believe memory access to be the weakest point in modern computer architecture, so I spend a lot of time playing with memory.

So today I toyed with a technique that subdivides the address space into one megabyte chunks. Each one of these chunks is used to allocate objects for a single polymorphic class. However, the classes aren't implemented with traditional vtable techniques. Instead they have an implicit vptr that points to the beginning of the one megabyte chunk that they live in. If enough objects are created that multiple chunks are needed for a given class then that means that multiple copies of the vtable would exist.

It's not a new idea; I think I first read about it in D&E a number of years ago. However, today was the first time I looked at it from the angle of making it the default allocation scheme used by the compiler. At that point I got stopped cold. Multiple inheritance would be a mess, but I think there's a way around that. It was placement new and stack allocation that ended things. Basically the only way I could think of handling them would have meant restoring the vptr member which renders the whole idea more or less pointless.

Oh well, tommorrow I think I'll start work in my code library to make the manual implementation less painful.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!