STL-String memory leak?

Gabriel Dos Reis Gabriel.Dos-Reis@cmla.ens-cachan.fr
Tue May 2 06:55:00 GMT 2000


Gero Krueger <krueger@obk.telekom.de> writes:

| Hello developers !
| 
| I've got some memory-problems using stl-strings.
| I'm running RH6.1 kernel 2.2.12 with g++ 2.95.1.
| 
| Please take a look at the following short piece of code:

[...]

| The programm should clear all memory allocated by
| the "new" statement.

"should clear" is strong a requirement.

| When I watch it with "ps axu" and take a look at its memory 
| consumption - no memory is freed.
| 
| My questions are: 
| 
| Can I really measure the memory consumption with ps ?

I don't think ps is accurate enough for measuring memory consumption
in a given program. 

| Did I make a basic mistake ?

I think the right question would be: when does 'free()' free memory?
But I bet the answer is completely orthogonal to the issue of possible
memory leakage in v-3's implementation of std::string.


-- Gaby


More information about the Libstdc++ mailing list