[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Memory size and allocation
- To: email@example.com
- Subject: Memory size and allocation
- From: Francesco Orsenigo <firstname.lastname@example.org>
- Date: Fri, 12 Apr 2002 18:41:33 +0200
- Delivered-To: email@example.com
- Delivered-To: mailing list firstname.lastname@example.org
- Delivery-Date: Fri, 12 Apr 2002 12:42:00 -0400
- Mailing-List: contact email@example.com; run by ezmlm
- Organization: Xarvh Project
- Reply-To: firstname.lastname@example.org
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?
Francesco Orsenigo, Xarvh Project