473,698 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

crash when run out of memory

jy
I have a C++ program which is "purify" clean, but crashes (called terminate)
when run out of memory on linux 2.4.27. From the core file, the crashes happen
after I throw an exception (after malloc returns null), and the stack winding
was calling the destructor of a large object. What's the genearl guidlines for
debugging, fixing, or at least making it a graceful exit than a crash?

Thanks,

-jy
Jul 22 '05 #1
3 3292
jy wrote:
I have a C++ program which is "purify" clean, but crashes (called terminate)
when run out of memory on linux 2.4.27. From the core file, the crashes happen
after I throw an exception (after malloc returns null), and the stack winding
was calling the destructor of a large object. What's the genearl guidlines for
debugging, fixing, or at least making it a graceful exit than a crash?

Thanks,

-jy


Without seeing your code it's impossible to be sure, but I suspect your
problem is platform specific (and due to overcommitment of memory in Linux).

[Followup-To set: news:comp.os.li nux.development .apps]

HTH,
--ag

--
Artie Gold -- Austin, Texas

http://it-matters.blogspot.com
Jul 22 '05 #2
jy wrote:
I have a C++ program which is "purify" clean, but crashes (called terminate)
when run out of memory on linux 2.4.27. From the core file, the crashes happen
after I throw an exception (after malloc returns null),
Did you say it is a C++ . Why would you use malloc then ?
Why not new ?
and the stack winding
was calling the destructor of a large object.


Was that large object defined as local to the function ?
Post some code here.

--
Karthik. http://akktech.blogspot.com .
' Remove _nospamplz from my email to mail me. '
Jul 22 '05 #3
"jy" <jy*******@yaho o.com> wrote in message
news:fa******** *************** ***@posting.goo gle.com...
I have a C++ program which is "purify" clean, but crashes (called terminate) when run out of memory on linux 2.4.27. From the core file, the crashes happen after I throw an exception (after malloc returns null),
I think it is new that throws the exception, not you. new is likely
using malloc internally and throwing std::bad_alloc when there is no
memory.
and the stack winding
was calling the destructor of a large object. What's the genearl guidlines for debugging, fixing, or at least making it a graceful exit than a crash?


Catch std::bad_alloc exception in main and report it:

int main()
{
try
{
/* the application code */
}
catch (std::bad_alloc const &)
{
cout << "no memory\n";
}
}

Ali

Jul 22 '05 #4

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

Similar topics

8
3210
by: Eric Brunel | last post by:
Hi all, I was creating a Tkinter widget in the style of the reversed tabs below Excel worksheets and I stepped in a serious problem: the code I made makes python crash with a seg fault, bus error or X11 BadGC error on both Solaris (2.6 and 2.7) and Linux (Mandrake 8.0); it doesn't crash on Windows. I tried to simplify the script, but I couldn't reproduce the crash with a simpler code. So the code below is somewhat long; sorry for that. ...
4
1707
by: Jürgen Devlieghere | last post by:
We encounter a crash every now and then at a client, and now I'm starting to doubt the fundamentals of life :-) We have a list of structs. struct SContactProperty { public: SContactProperty(void) : m_strName(_T("")), m_strValue(_T("")), m_bHidden(false) {};
10
9537
by: xixi | last post by:
i have db2 udb v8.1 on windows 64 bit 2003 server, after db2 server start , i found this in the db2diag.log, is this error? 2004-05-05-15.28.30.780000 Instance:DB2 Node:000 PID:1692(db2syscs.exe) TID:2860 Appid:AC10040A.GD5F.00FC56D8BEC5 base sys utilities sqledint Probe:30 Crash Recovery is needed. 2004-05-05-15.28.31.890000 Instance:DB2 Node:000
4
2852
by: arizvi | last post by:
Hi, My program crashes when it reaches a certain line. There is nothing wrong with that particular line as I have changed it to something simple like i=0, and it still crashes. If I remove some paras of code from lines previous to this line, the program run fine and does not crash. So I think that this has to do with some kind of overflow. It seems to me that if the number of lines of code accessed by my program goes above a limit, it...
3
2767
by: Brad | last post by:
I have an aspx web page which initially displays fine. When I postback the resulting response back to the client output is causing InternetExplorer 6 to crash. I've disabled the server side code for the submit button so what is be going back to the client is just a recyling of the content. I used a responsefilter to capture the initial content and the content which caused IE to crash: Comparing the two files using a file compare...
6
2888
by: pradeep_TP | last post by:
Hi all, I am using IIS 5.0 and this question is regarding working of ASP.net worker process. I have only one web application right now on my web server. This means that only one AppDomain will be created inside a single worker process. NOw for example, due to some reason, my web application generated a stack overflow error and crashed my appdoman (this happend in real case). In this case as far as my knowledge goes, only appdomain...
3
2288
by: Lyndsey.Ferguson | last post by:
Hello Everyone, I am investigating a crash within our application that has me stumped. I am developing for Mac OS X, but I believe that this may be a regular gcc c++ type question. Here is the stack crawl of where the application is crashing: Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_INVALID_ADDRESS (0x0001) at 0x0c3968c0
34
4459
by: NewToCPP | last post by:
Hi, Why does a C/C++ programs crash? When there is access to a null pointer or some thing like that programs crash, but why do they crash? Thanks.
2
3557
by: kevinding | last post by:
Hi All, We meet an evil condition for our project. Our project has 3 layers. A C# layer to do some business logic, and Managed C++ layer translate managed values to native ones or vice verse.(vs2005, /clr:oldSyntax) . UI layer are written in native C++. Currently, we meet a random crash bug in release build. It is ok in debug build. If we replace the managed c++ dll with the debug one, it works also. So we think there must be...
110
10579
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst case scenario for MyISAM backend? Also is it possible to not to lose data but get them corrupted?
0
8608
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9161
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6522
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.