Date: Sun, 13 Jun 1999 11:42:31 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Grzegorz Jablonski cc: djgpp AT delorie DOT com Subject: Re: Exec does not free all memory In-Reply-To: <7jth75$fqf$1@kujawiak.man.lodz.pl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sat, 12 Jun 1999, Grzegorz Jablonski wrote: > When the program below (run as parent.exe 0) is run, it eventually allocates > all the dos memory and quits. Similar program compiled with Borland C 3.1 > works correctly. I suspect that the problem is probably with the transfer > buffer, which is not freed after exec. It is actually much worse: _none_ of the memory, DOS or otherwise, is freed when you call one of the functions of the `execXX' family. The problem is that DOS doesn't have the `exec' system call that overwrites the program with another image, so `execXX' are actually `spawnXX' in disguise: they call `spawn', and then exit to DOS. Obviously, the transfer buffer and other memory cannot be freed on `exec' because the parent program still runs; in particular, the transfer buffer is used to pass the long command line to the child program. If you know how to avoid these problems when calling programs, please suggest a solution. > The problem occured, when I tried to > upgrade the program version from within the program itself. I don't see how this could cause any practical problems: the conventional memory usage by each subsidiary program is about 18KB, so you need much more than a single `exec' to eat up all the conventional memory, unless you have 20KB to begin with.