Mail Archives: djgpp/1998/02/08/17:15:44
Jamie Love wrote:
>
> hi, guys
>
> A question, if i have a linked list with each node of the list having data
> of about 40 bytes in
> length, and about 80 - 150 nodes, will memory defragmentation happen.
> Should I alloc for, say 50 nodes at a time?
Hmm. No. Each node requires 16 bytes ( *next, *prev, *data, slack)
so 150 Nodes are .. a piece of cake. Even with overhead this may be 32
bytes per node, so this are some 5kB of memory plus, say 256 for each
data set, so I'd say forget about it. What one should really always take
care of is freeing unused data + node, especially in long running
programs.
--
Ciao
Tom
*************************************************************
* Thomas Demmer *
* Lehrstuhl fuer Stroemungsmechanik *
* Ruhr-Uni-Bochum *
* Universitaetsstr. 150 *
* D-44780 Bochum *
* Tel: +49 234 700 6434 *
* Fax: +49 234 709 4162 *
* http://www.lstm.ruhr-uni-bochum.de/~demmer *
*************************************************************
- Raw text -