leaks & segfaults w/ exceptions in egcs-1.1.2 & gcc-2.95.2
Tudor Hulubei
tudor.hulubei@ecora.com
Wed Feb 16 20:23:00 GMT 2000
Hello,
The attached code leaks memory on RedHat 6.0 w/ egcs-1.1.2 when
compiled w/o optimizations (it grew a little bit over 300Mb). When
compiled with -O2 it leaks about 20Mb and then segfaults.
With gcc-2.95.2 things are looking a little bit better, in the sense
that w/o optimizations the code doesn't leak (it is using about
1.2Mb), but when compiled w/o optimizations it leaks about 8Mb and
then it crashes...
Any hints? Can someone point me to the code in the gcc-2.95.2 that
fixed the leak (or part of it) so that I can port it back to
egcs-1.1.2? Our code runs on the Cobalt Qube2 and I couldn't get
gcc-2.95.2 to work on that.
Thanks,
Tudor
#include <stdexcept>
int
main(int argc, char* argv[])
{
for (size_t i = 0; i < 10000000; i++)
{
try
{
throw invalid_argument(argv[0]);
}
catch (invalid_argument)
{
}
}
return 0;
}
More information about the Gcc-bugs
mailing list