This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Migration from RWTools to string - problems [newbie]


Are you attempting to modify the strings using the pointer returned by
c_str()?  If so, DON'T!  Otherwise, normally, calling c_str() several
times should not cause a memory leak or cause your program to crash.
Have you tried looking at the stack trace to see where it is crashing?

Thanks,
Lyle Taylor

-----Original Message-----
From: Krzysztof.Wisniowski@siemens.com
[mailto:Krzysztof.Wisniowski@siemens.com] 
Sent: Monday, September 29, 2003 9:06 AM
To: gcc-help@gcc.gnu.org
Subject: Migration from RWTools to string - problems [newbie]

Hi all,

	I am trying to adapt a code which uses Rogue Wave libraries for
string manipulation, to use std::string. So far I have managed to
compile
and link the program with little modifications in the source code,
mostly by
replacing the .data() with .c_str() method. The main program consists of
the
for() loop which iterates through the file list, and applies some
calculations to the files data. After the changes I've made the program
completes only one full loop run, the second run almost always ends up
with
"Bus error" or "out of memory" error, all in the random places of the
loop.
Does anyone know if std::string might not entirely free the used
resources,
or do I have to look for something else to blame?
I am looking for some function to display the free memory, perhaps that
would give me any idea what goes wrong in the program, unfortunately I
cannot find any. Can you give me some hints?
I am working on SunOS 5.8 with gcc++ 2.95.3.

Thanks,
Krzysztof

-- 
Krzysztof Wisniowski   | Siemens Sp. z o.o.
ICM N&S SDC NE 3       | Software Design Center
Phone: +48 71 799 2403 | 54A Strzegomska Str.
Fax: +48 71 799 2320   | 53-611 Wroclaw POLAND


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]