473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

stl string append function on SLES9 ( 32 bit and 64 bit machine)

Hi

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)

Mohan


Jul 13 '06 #1
3 2084
* 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?
Jul 13 '06 #2
"Mohan" <mo**********@in.bosch.comwrote in message
news:e9**********@ns2.fe.internet.bosch.com...
Hi

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 sounds like you're running out of memory, especially with new() throwing.
Do the machines have the same amount of memory?

180MB is rather large to load into memory at one time anyway. It would
probably be good for you to redign the application to not have to load the
entire file at once.
Jul 13 '06 #3
"Mohan" <mo**********@in.bosch.comwrote:
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,
How much memory do you have? I hope a lot, because you're
stressing the hell out of it. Do you have to read the whole
file in at once? Can't you process it a bit at a time?
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.
Well, then, there you go. Use smaller files, or break larger
files into smaller, or process files incrementally.

Suggestion:

open file to be processed as an ifstream;
open a new output file as an ofstream;
while (input file stream good)
{
read small chunk of data from input file into RAM;
if (input file is eof) break;
process data;
append processed data to output file;
}
close files.
Is it problem with library or architectures ( 32 bit and 64 bit)
More likely a problem with inflicing cruel and unusual punishment
on your system's resources.
--
Cheers,
Robbie Hatley
East Tustin, CA, USA
lone wolf intj at pac bell dot net
(put "[usenet]" in subject to bypass spam filter)
http://home.pacbell.net/earnur/
Jul 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ken Fine | last post by:
No joy on Macromedia's boards after a few days; maybe someone can help me here. I got an excellent string handling function off of planet-source-code.com that converts text strings to proper...
6
by: Frank King | last post by:
Hi, I am looking for a hash function to map string to string in VB. Could somebody give me some informtion? Thank you very much. fk
8
by: ais523 | last post by:
I use this function that I wrote for inputting strings. It's meant to return a pointer to mallocated memory holding one input string, or 0 on error. (Personally, I prefer to use 0 to NULL when...
5
by: randomtalk | last post by:
hello, recently i tried to use list.append() function in seemingly logical ways, however, i cannot get it to work, here is the test code: >>> seed = >>> next = 7 >>> seed1 = seed.append(next)...
4
by: Vemund Halvorsen | last post by:
Hello, What is the best way of mapping a string to function/sub? See ex bellow - probably not the best way - especially when it comes to maintenance ;) Does anybody have a better way of doing...
2
by: jeremito | last post by:
I have created a class that inherits from the list object. I want to override the append function to allow my class to append several copies at the same time with one function call. I want to do...
8
by: Lothar Behrens | last post by:
Hi, I have selected strtok to be used in my string replacement function. But I lost the last token, if there is one. This string would be replaced select "name", "vorname", "userid",...
2
by: pralu | last post by:
EventLogEntryStruct EventLogEntry; for(int i=1;;i++) { EventLogEntry.logName = "log-"; EventLogEntry.eventString = "event-"; EventLogEntry.bufPos = i; EventLogEntry.logIdx =...
2
by: John | last post by:
Hi Is there a way to overload split function from system.string? Thanks Regards
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.