<div dir="ltr"><div class="gmail_quote">I would say that removing the exit call leaves a lot of memory unreachable since it's supposed to be freed by the process destruction procedure.<br><div dir="ltr"><br>Try launching your own process:<br>
<br><div style="margin-left: 40px;">
<span style="font-family: courier new,monospace;">// For fork().</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#include <unistd.h></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">// For waitpid().</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#include <sys/wait.h></span><br></div><div style="margin-left: 80px;">
<br></div><div style="margin-left: 40px; font-family: courier new,monospace;">...<br><br>void MyClass::launch() {<br><br></div><div style="margin-left: 80px; font-family: courier new,monospace;">int res = -1;<br></div><div style="margin-left: 40px; font-family: courier new,monospace;">
<br></div><div style="margin-left: 80px; font-family: courier new,monospace;">if ((res = fork()) == 0) {<br>
// Child process<br><br> // Initializations is your class inheriting from USER_initialize<br> Initializations init;<br><br> bcp_main(0, NULL, &init);<br></div><div style="margin-left: 80px; font-family: courier new,monospace;">
}<br>else if (res > 0) {<br> // Parent process<br> <br> int status = 0;<br><br>
waitpid(res,&status,0);<br><br> assert(WIFEXITED(status));<br>}<br>else {<br> // error forking<br>}<br></div><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">}</span><br></div><br>
<br>I don't know if it's the best way to go but it works for me.<br><br clear="all">Dani Pérez.<br>
<br><br><div class="gmail_quote"><div><div></div><div class="Wj3C7c">On Tue, Sep 2, 2008 at 5:49 PM, Eric W Anderson <span dir="ltr"><<a href="mailto:Eric.Anderson@colorado.edu" target="_blank">Eric.Anderson@colorado.edu</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">
I'm new to using BCP, so I apologize if this is a dumb question: Is there a<br>
right way to invoke a BCP-based solver as a subroutine? I see that bcp_main<br>
terminates with exit(), at least in serial mode, rather than returning. If I<br>
comment out the exit(0) call in BCP_single_environment::register_process(), and<br>
my application calls bcp_main(), everything seems to work as intended.<br>
<br>
It seems like this is actively subverting the way BCP wants to be run, though,<br>
so I'm wondering: (a) is there a hidden pitfall to doing what I'm doing, and<br>
(b) is there a better way to be doing it?<br>
<br>
Thanks for any help,<br>
Eric<br>
<font color="#888888"><br>
--<br>
Eric W. Anderson University of Colorado<br>
<a href="mailto:eric.anderson@colorado.edu" target="_blank">eric.anderson@colorado.edu</a> Dept. of Computer Science<br>
phone: +1-720-984-8864 Systems Research Lab - ECCR 1B54<br>
<br>
PGP key fingerprints:<br>
personal: 1BD4 CFCE 8B59 8D6E EA3E EBD5 4DC9 3E61 656C 462B<br>
academic: D3C5 D6FF EDED 9F1F C36D 53A3 74B7 53A6 3C74 5F12<br>
</font><br></div></div>-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.6 (GNU/Linux)<br>
<br>
iD8DBQFIvWCBdLdTpjx0XxIRAtv+AJ0X2brpHmeML1BjQz1tLpMItU24fgCffjZ2<br>
cVaXoVM71rxqLyiCUqRpK1Q=<br>
=D/BK<br>
-----END PGP SIGNATURE-----<br>
<br>_______________________________________________<br>
BCP mailing list<br>
<a href="mailto:BCP@list.coin-or.org" target="_blank">BCP@list.coin-or.org</a><br>
<a href="http://list.coin-or.org/mailman/listinfo/bcp" target="_blank">http://list.coin-or.org/mailman/listinfo/bcp</a><br>
<br></blockquote></div><br></div>
</div><br></div>