uint8*block=(uint8*)aligned_malloc(NL_DEFAULT_MEMORY_ALIGNMENT+size,NL_DEFAULT_MEMORY_ALIGNMENT);//new uint8[size + sizeof(uint)]; // an additionnal uint is needed to store size of block
if(!block)returnNULL;
#ifdef NL_DEBUG
_MemBlockToAllocID[block]=_AllocID;
#endif
*(uint*)block=size;
returnblock+sizeof(uint);
returnblock+NL_DEFAULT_MEMORY_ALIGNMENT;
}
uintentry=((size+(_Granularity-1))/_Granularity);
nlassert(entry<_ObjectSizeToAllocator.size());
if(!_ObjectSizeToAllocator[entry])
{
_ObjectSizeToAllocator[entry]=newCFixedSizeAllocator(entry*_Granularity+sizeof(uint),_MaxAllocSize/size);// an additionnal uint is needed to store size of block
_ObjectSizeToAllocator[entry]=newCFixedSizeAllocator(entry*_Granularity+NL_DEFAULT_MEMORY_ALIGNMENT,_MaxAllocSize/size);// an additionnal uint is needed to store size of block