I have a big chunk of memory (128M), which is divided into 4 memory banks.. Now, I am supposed to make efficient memory utilization,and for that purpose, I NEED TO ALLOCATE MEMORY FROM THE ADDRESSES I PROVIDE. Now, here's what the problem... We have a system defined malloc( ) source which I'm not supposed to change.
So, one way I can think of is...
do a malloc and compare with the address I want to allocate memory at.
if not equal, then call malloc again, & free the previous memory
continue this till I reach the address I want to allocate memory at
But this is really very inefficient and slow method..
Since I'm not supposed to change the malloc source code,
Does somebody have any idea how to trick the heap manager, or by some pointer manipulations, or by writing wrapper routines, anyway, so that I can allocate a memory chunk at the address I provide.