[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Memory size and allocation




I've got two questions:

1) Is there a portable way to know the size of a malloc()ed memory block, 
knowing just its address?

2) When malloc() fails, my program frees memory up to the required size, in 
the hope that the freed blocks were contiguos.
The eldest memory blocks (in order of usage) are freed first.
Is this a good way to handle data dynamically?
How can I improve it?

Thank you,
Francesco Orsenigo, Xarvh Project