From: Thomas Demmer Newsgroups: comp.os.msdos.djgpp Subject: Re: Memory defrag Date: Sun, 08 Feb 1998 22:56:52 +0100 Organization: Lehrstuhl fuer Stroemungsmechanik Lines: 30 Message-ID: <34DE2A24.17298F03@LSTM.Ruhr-UNI-Bochum.De> References: <199802082031 DOT JAA15379 AT fep1-orange DOT clear DOT net DOT nz> NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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 * *************************************************************