Author: Bo Persson
Date: 09:13:11 06/05/01
Go up one level in this thread
On June 05, 2001 at 11:18:55, Robert Hyatt wrote: >On June 05, 2001 at 10:39:29, Marcus Heidkamp wrote: > >>On June 05, 2001 at 08:41:07, Wayne Lowrance wrote: >> >>>What are nenirt leaks >>>Thax >>>Wayne >> >>Unless I did a serious mistype: I mean memory leaks. This happens whenever you >>allocate memory in your program without explicitly freeing it after usage. The >>memory menagement functions think this memory is still needed, so they will not >>be allocated for other memory requests. Usually you should free all memory that >>is no longer needed, so your program can allocate more dynamically. >> >>Marcus > > >I'm not sure I follow here. Once he allocates buffers, they are needed until >the program terminates. It is a total waste of time to free things just before >you terminate as that causes the "free" stuff to be done _twice_. Once by >the C library to your virtual memory address space (for the free() calls) and >then once by the OS to mark the entire program's physical addresses as "free" >when it terminates... This *was* a big deal when programming for MS-DOS and Windows 3.x, as these systems did not have a real process concept. All programs ran in cooperating multi-tasking with a shared memory system. As a result, the OS couldn't know which program was the last user of a block of memory, so it was never freed. With Windows 95/NT an on (and all UNIXes, of course) this is not a problem. When a program terminates, all its resources will be recycled. Bo Persson bop@malmo.mail.telia.com
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.