[fdo-internals] gcc mt_alloc related bugs?

Frank Warmerdam warmerdam at pobox.com
Fri Feb 16 03:26:35 EST 2007


Folks,

I mentioned a couple days ago that I was still seeing crashes under
some circumstances after my 64bit fixes.  I have spent more hours than
I wish to contemplate digging into these crashes and have not come up
with a particular satisfying answer.

The crashes seemed to be related to corruption of the freelist
datastructures maintained by the mt_alloc allocator for stl vector
objects (ie. the XalanDOMString).

On Linux with glibc it seems you can define the environment variable
GLIBCXX_FORCE_NEW to force a new and delete to be done each time stl
container allocate or free memory, instead of using the mt_alloc pool
allocator.  This seems to avoid the problem.  I *thought* when running
in this mode I would finally be able to find the bug in the FDO code
using valgrind, but things run perfectly clean!

Based on a variety of googling, I am now suspecting that my Ubuntu
gcc 3.4 build is suffering from the problem described at:

   http://bugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=293466

So, if people are running into strange crashes, and tracebacks in
gcc show it being deep in the glibc mt_allocator while destroying
XalanDOMString's, I would suggest defining the GLIBCXX_FORCE_NEW
environment variable.  I results in a 20-30% speed reduction in
the FDO core unit tests, so there is a performance impact.  But things
run clean.

I *imagine* this is fixed in newer versions of Debian/Ubuntu.  I'm running
one generation behind (Ubuntu Breezy Badger).

God my head hurts.

PS. Google on mt_alloc and GLIBCXX_FORCE_NEW is educational for those
so inclined.  Mateusz - please read up on this so you can help me next time
I have this problem, and I've completely forgotten what I learned this time.

:-)

Now enjoying my FDO Core UnitTest results:

OK (102)


Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the fdo-internals mailing list