Boost logo

Boost-Build :

From: Martin Kortmann (email_at_[hidden])
Date: 2007-12-01 09:20:01


Hi,

I have found an serious memory leak in bjam rev 41518,
who is responsible for this?

The leak is inside execnt.c. CreateProcess opens an
Handle to the new processes thread. This handle
will never beclosed.
So bjam crashes after execution of more than 60000 commands
or Createprocess will fail systemwide(!) and somtimes windows
crashes completely (bluescreen).

Index: execnt.c
===================================================================
--- execnt.c (revision 41518)
+++ execnt.c (working copy)
@@ -539,6 +539,7 @@
         string_free(&cmdtab[i].target); string_new(&cmdtab[i].target);
         string_free(&cmdtab[i].command); string_new(&cmdtab[i].command);
         if (cmdtab[i].pi.hProcess) {
CloseHandle(cmdtab[i].pi.hProcess); cmdtab[i].pi.hProcess = 0; }
+ if (cmdtab[i].pi.hThread) { CloseHandle(cmdtab[i].pi.hThread);
cmdtab[i].pi.hThread = 0; }
         if (cmdtab[i].pipe_out[0]) {
CloseHandle(cmdtab[i].pipe_out[0]); cmdtab[i].pipe_out[0] = 0; }
         if (cmdtab[i].pipe_out[1]) {
CloseHandle(cmdtab[i].pipe_out[1]); cmdtab[i].pipe_out[1] = 0; }
         if (cmdtab[i].pipe_err[0]) {
CloseHandle(cmdtab[i].pipe_err[0]); cmdtab[i].pipe_err[0] = 0; }

Maybe this is also the real solution for the "write to
command bat file" workaround, but i havn't looked into this.

Martin


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk