This is the mail archive of the
mailing list for the GCC project.
STL / MySQL / __USE_MALLOC
- To: <gcc at gcc dot gnu dot org>
- Subject: STL / MySQL / __USE_MALLOC
- From: <stefan at noname4us dot com>
- Date: Fri, 26 Oct 2001 13:02:55 +0200
We are developing a MT server based on the pthreads library on Linux (2.4.12).
The basic setup is: Main loop does accept(), push_back socketdescr to vector,
picked up by workers, workers can cache their results into a global hash_map
We are compiling using GCC 3.0.1 (which seems to conform great to the ISO, nice
Compiling using default (only -pthread -lpthread) gives no warnings, and the
server will run perfectly with one connection. As soon as two threads are
working we seem to get some kind of "race condition" for allocating memory and
the application runs painfully slow...
...recompiling using __USE_MALLOC seems to work at first, but since we do lot's
of insert/delete's in the hash_map we seem to fragment the memory to the point
that it crashes.
Next issue is related to freeing memory, using __USE_MALLOC we seem to get a
memory leak (of if this is related to memory fragmentation, I'm not sure) which
over time bogs down the server...
Since the server is mainly STL code and we have successfully developed
applications purely on STL before it seems like we have "found a way" to get
multiple memory allocator into the same application, that's why i mentioned
MySQL in the subject - this is the only other linked library that we know will
Thanks in advance!