Hello, Kenneth Karoliussen wrote:
> Hi, > > I'm currently working on FreeBSD with and using GNU g++ v3.4.4. > > The following code leaks and sometimes crashes with a bus error. I can confirm the leak with gcc as delivered with SuSE 9.3. gcc version 3.3.5 20050117 (prerelease) (SUSE Linux) It is a stack leak, the stacks keeps growing, as observable with a debugger. g++ 4.0.3, 3.4.6, 3.4.4, 3.4.3, 3.3.6, and 3.3.4 do not to show the problem, but g++ 3.3.5 or its prereleases might. I think this is an error in older gcc releases, where stack space for temporaries is not reused, where it should. Another workaround seems to be putting the code within the try block into a function of it's own. This seems to cleanup the stack. void madness() { sayA(getA()); } int main(int argc, char* argv[]) { while (true) { try { madness() ; } catch (const char* const c) { if (c) cerr <<"Exception: " <<c <<endl; } }; Bernd Strieder _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus