I am writing my memory manager.I want to allocate single chunk of memory with different size to 2d dymensional arrays from memory pool.I know how to overload new and delete. But dont know how to creaate and manage memory pool and allocating memory to array. I surf net but most of them overload new with in a class(mostly useful for game developers) and do not have memory pool. can anybody give me some clue or guide me to useful references or show me a simple example to find my way in custom memory allocator?.
could you please tell me the name of those pool allocators?(particularly the simple one with less complexity.)
I read in web that boost lib is not so good at least not yet. by the way I want do it my self for my application.
I want to implement my allocator but why?
I am working on performance issues on multicore .so I want to have some experiments on allocator and its Impact on my application behaviour (ofcourse I know it leads to achieving considerable speed in application which request/release memory too much) i.e test locality in memory allocation and thereafter working on separeate pool for each core and working on allocator algorithms(bestfit,ff,...).actually I need to learn and experiment it my self to grasp concepts fully. I know about tcmalloc and hoard I also tested hoard but it takes longer time than original fedora core allocator with g++ 4.7 I contact the author but could not find the reason.
I know about prematured optimization and its impact. Currently I want to allocate any size single contigious chunk of memory to 2d array and after that supporting thread requests for memory(mybe I should overload new globally in my application inorder to let thread request memory from my pool).
I want to start from scratch or mabe reinvent the wheel.But I think I need to experiment it but could not find good reference or tutorial for that I heard of book effective c++ by Scott Meyers but I have no access to that book.
Currently I want to allocate any size single contigious chunk of memory to 2d array and after that supporting thread requests for memory
That's not enough detail: any allocation gives a contiguous chunk of memory, and all (reasonable) 2D array libraries use single allocations. You said you tested hoard, do you have a compilable test case?
yes for this syntax type name [size][size] but when creating 2d array with pointers then hardly can say all 2d array are in one chunk specially if corun application agressively requst/release memory. cause you have rows/columns of pointer which each points to one column /rows each then there is no garanties to allocate memory in contiguous physical memory location.
do you have a compilable test case?
I used hoard benchmark cache-scractch and others in available benchmark folder and compile it by linking libhord.so to it but the result was as i said I also write my own test but I deleted. you can find my query about hoard problem here https://github.com/emeryberger/Hoard/issues/6
thanks for links ,I also tried googling with "memory pool" I found some example. before that I searched just memory manager or allocator. I dont know why I didnt search this keyword!!!.