[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Memory size and allocation
- To: linuxgames@sunsite.dk
- Subject: Memory size and allocation
- From: Francesco Orsenigo <xarvh@lombardiacom.it>
- Date: Fri, 12 Apr 2002 18:41:33 +0200
- Delivered-To: archiver@seul.org
- Delivered-To: mailing list linuxgames@sunsite.dk
- Delivery-Date: Fri, 12 Apr 2002 12:42:00 -0400
- Mailing-List: contact linuxgames-help@sunsite.dk; run by ezmlm
- Organization: Xarvh Project
- Reply-To: linuxgames@sunsite.dk
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