Mail Archives: djgpp/1999/06/13/07:43:27
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.
- Raw text -