* Mohan:
>
I face a problem with the stl string append on our 32-bit SLES9 machine .
(It is not happening on SLES9 64-bit machines and on SuSE 10).
When we read a 179MB file into the memory,
m_oString.append(awchDestinationStr, a_nTotalNumOfUnicodes) is crashing
Leads to a crash in libstdc++ new() on 32-bit SLES9 machine byut working
fine with SLES9 64-bit machines and on SuSE 10
When we read a smaller file (I tried a 30MB file) it works.
Is it problem with library or architectures ( 32 bit and 64 bit)
It's probably a problem with your code. When you have the possibility
of memory exhaustion, use std::set_new_handler to set up a failure
handler, and let that one log the incident and exit cleanly (not much
you can do). Alternatively, catch the std::bad_alloc exception
somewhere where the program can make further progress.
Make sure that you don't do needless copying of data. 180 MB is already
in the neighbourhood of 1/10 of available address space (or perhaps
1/20). You don't need many copies, like e.g. temporary copies
introduced by copy construction, before memory is exhausted.
Find the data size that the program is comfortable with and document it,
or if you need to handle data of any size, do the right thing and
process it one chunk at a time, with most of it on disk at any time.
Having said all this, please consult the FAQ about how to post.
Especially the FAQ item "How do I post a question about code that
doesn't work correctly?", currently at <url:
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8>.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?