Unix Programming - Re: segmentation fault when shared object using STL is statically

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > November 2005 > Re: segmentation fault when shared object using STL is statically





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: segmentation fault when shared object using STL is statically
Paul Pluzhnikov

2005-11-24, 5:54 pm

"Maxim Yegorushkin" <maxim.yegorushkin@gmail.com> writes:

> libstdc++ allocator does caching. Will there be any problems when
> memory allocated and freed by allocators in different DSOs?


Not usually: the allocator gets a large "chunk" from malloc(),
slices it into object-sized pieces, and gives them to the
application.

If the app then "gives it back", the slice goes onto the allocator's
free-list.

It doesn't matter which instance of the allocator gets the slice.

The only trouble with mismatch can come as a memory leak, if the
allocator which has non-empty freelist is in a DSO which gets
unloaded (via dlclose()). But the exact same trouble would come
even without mismatch: load a DSO with libstdc++ statically bound
into it, construct some objects, unload the DSO -- the exact same
leak will result (assuming the objects aren't destructed in the
DSO finalizer).

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com