Original Post
ok i'm starting work on a memory manager that i think should minimize fragmentation in my engine -my idea is to first allocate a table of 10000 or so handles (simple structures no more than 10 bytes each, not too big an overhead) -and a large shared memory pool, say 20 MB -then, when an object is to be newed or allocated, a chunk of that pool is set apart -whenever there are spare cpu cycles, an optimizer thread runs, defragmenting the pool -nonmanager code (NMC) rarely uses pointers directly, only handles, which are permanent pointers -however, when NMC needs to use a pointer, it tries to lock a handle (tells the defragmenter not to touch that memory chunk), and when NMC is done, unlocks that handle -this will all be done with elaborate use of templates and some algorithms ill need to devise now here comes the real question/problem to begin with, the memory pool pointer is not an absolute pointer, since only the OS works in absolute memory so my question is, how do i determine and align chunks of the shared pool to, say a 32 or 128 bit boundary?