Topic: Repetitive spawnl use & runtime mem limits
Author: rwmurphr@essex.ecn.uoknor.edu (Robert W Murphree)
Date: 5 Apr 1994 02:14:21 GMT Raw View
My problem is a large Borland C++ project (about 6000 lines)
which uses a spawnl function to call an executable file
multiple times (dozens if not hundreds of times) which
runs up against memory limits the second or third time
the spawnl function is called.
the spawnl code is:
spawnl(P_WAIT, "H:\\RENT\\LIB\\FINDHULL.EXE",NULL);
I wrote a small calling program in C++ which calls the above line
500 times and still no error. I also know the findhull.exe file
is executing properly, at least the first time.
I could probably reduce the amount of memory used at run-time in
the large, main program and get a few more iterations out of the
file. But it seems to me that probably there is no reason to believe
hat the DOS system I'm running under (5.0) is smart enough to
de-allocate the memory used by the spawned code after it is used
each time. So probably no matter how much I reduce the main program
memory size, I am going to run up against memory limits on the 30th
or 40th call to my spawn code. The obvious thing is to code the
fortran code for the findhull.exe in C++ and be done with it. By the
way, its a microsoft fortran compiler, of about 220 lines.
So my question is: Is it the case that the memory being used by the
spawn code is not being freed up after every call. And how would I
find that out if it is the case?
I will watch this space religiously, but E-mail would be appreciated.
Thanks
Robert Murphree
Mobile Roboticist with simulation in C++
Author: diamond@tkt.dec.com (Norman Diamond )
Date: 6 Apr 1994 00:52:37 GMT Raw View
In article <2nqhht$ne0@constellation.ecn.uoknor.edu> rwmurphr@essex.ecn.uoknor.edu (Robert W Murphree) writes:
>My problem is a large Borland C++ project (about 6000 lines) which uses a
>spawnl function to call an executable file multiple times (dozens if not
>hundreds of times) which runs up against memory limits the second or third
>time the spawnl function is called. the spawnl code is:
>spawnl(P_WAIT, "H:\\RENT\\LIB\\FINDHULL.EXE",NULL);
Since you posted to comp.std.c++ and comp.std.c, I assume you mean system()
instead of spawnl(). The standard does not say under what conditions the
standard function system() may fail, and it does not say what kind of
return values indicate success or failure (let alone various types of
failure). It does say that the return value is implementation-defined.
So you might look in your manual for the implementation-defined values,
or ask in a newsgroup pertaining to your implementation.
>So my question is: Is it the case that the memory being used by the
>spawn code is not being freed up after every call. And how would I
>find that out if it is the case?
The standard permits such unfriendly behavior. Only market forces can
put an end to it.
--
<< If this were the company's opinion, I would not be allowed to post it. >>
A program in conformance will not tend to stay in conformance, because even if
it doesn't change, the standard will. Force = program size * destruction.
Every technical corrigendum is met by an equally troublesome new defect report.