473,397 Members | 1,974 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,397 software developers and data experts.

prevent dumping core file?

ken
hello,
i'm writing a c program on a linux system. i'm debugging a segmentation
fault but i don't want it to dump a core file because the memory
footprint of the program is over 300Mb and i don't need it to generate a
300Mb file every time I add a new printf statement to debug the code.

can i do something to prevent it from dumping the core file even when it
seg faults? (is this a unix/linux thing, or a c thing?)

thanks!
ken
Nov 14 '05 #1
10 3980
ken <ke*@nospam.com> spoke thus:
can i do something to prevent it from dumping the core file even when it
seg faults? (is this a unix/linux thing, or a c thing?)


(It's a *nix thing. comp.unix.programmer might be useful.)

Your post is off-topic for comp.lang.c. Please visit

http://www.csclub.uwaterloo.ca/u/dj3...lc-welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html

for posting guidelines and frequently asked questions. Thank you.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 14 '05 #2
ken <ke*@nospam.com> scribbled the following:
hello,
i'm writing a c program on a linux system. i'm debugging a segmentation
fault but i don't want it to dump a core file because the memory
footprint of the program is over 300Mb and i don't need it to generate a
300Mb file every time I add a new printf statement to debug the code. can i do something to prevent it from dumping the core file even when it
seg faults? (is this a unix/linux thing, or a c thing?)


It's a Unix/Linux thing.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Immanuel Kant but Genghis Khan."
- The Official Graffitist's Handbook
Nov 14 '05 #3
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message news:<bu**********@oravannahka.helsinki.fi>...
ken <ke*@nospam.com> scribbled the following:
hello,
i'm writing a c program on a linux system. i'm debugging a segmentation
fault but i don't want it to dump a core file because the memory
footprint of the program is over 300Mb and i don't need it to generate a
300Mb file every time I add a new printf statement to debug the code.

can i do something to prevent it from dumping the core file even when it
seg faults? (is this a unix/linux thing, or a c thing?)


It's a Unix/Linux thing.


It is indeed a linux thing. C has nothing to do with dumping a core
file.
The linux kernel writes out a file containing a core image of a
terminated process when certain signals are received. The core image
file is written
in the process's working directory. For more information you may
see the man page of core.
To prevent it from dumping the core file,you may create a directory
named
"core" in your working directory.
Nov 14 '05 #4
nrk
rahul dev wrote:
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message
news:<bu**********@oravannahka.helsinki.fi>...
ken <ke*@nospam.com> scribbled the following:
> hello,
> i'm writing a c program on a linux system. i'm debugging a segmentation
> fault but i don't want it to dump a core file because the memory
> footprint of the program is over 300Mb and i don't need it to generate
> a 300Mb file every time I add a new printf statement to debug the code.
> can i do something to prevent it from dumping the core file even when
> it seg faults? (is this a unix/linux thing, or a c thing?)


It's a Unix/Linux thing.


It is indeed a linux thing. C has nothing to do with dumping a core
file.
The linux kernel writes out a file containing a core image of a
terminated process when certain signals are received. The core image
file is written
in the process's working directory. For more information you may
see the man page of core.


I seriously doubt if there's a man page for core on a Linux system.
To prevent it from dumping the core file,you may create a directory
named
"core" in your working directory.


A better(?) solution is to use the ulimit (bash) or limit (csh/tcsh)
builtins to set the limit for coredumpsize to 0. To OP: man bash and
search for ulimit to see how this can be done.

-nrk.

--
Remove devnull for email
Nov 14 '05 #5
rahul dev <ra***********@hotmail.com> wrote:
To prevent it from dumping the core file,you may create a directory
named
"core" in your working directory.


or simply set "ulimit -c 0" but that would only be the way it
was meant to be done.
Nov 14 '05 #6
ken wrote:
hello,
i'm writing a c program on a linux system. i'm debugging a segmentation
fault but i don't want it to dump a core file because the memory
footprint of the program is over 300Mb and i don't need it to generate a
300Mb file every time I add a new printf statement to debug the code.

can i do something to prevent it from dumping the core file even when it
seg faults? (is this a unix/linux thing, or a c thing?)

thanks!
ken


'limit core 0' in tcsh, or setrlimit() in the program itself. But
Murphy's Law is gonna GET you...

--
Michel Bardiaux
Peaktime Belgium S.A. Bd. du Souverain, 191 B-1160 Bruxelles
Tel : +32 2 790.29.41

Nov 14 '05 #7
mi*************@peaktime.be wrote...
ken wrote:
hello,
i'm writing a c program on a linux system. i'm debugging a segmentation
fault but i don't want it to dump a core file because the memory
footprint of the program is over 300Mb and i don't need it to generate a
300Mb file every time I add a new printf statement to debug the code.

can i do something to prevent it from dumping the core file even when it
seg faults? (is this a unix/linux thing, or a c thing?)

thanks!
ken


'limit core 0' in tcsh, or setrlimit() in the program itself. But
Murphy's Law is gonna GET you...


'touch ./core ; chmod 000 ./core' trumps Murphy if '.' is the cwd of
the program dumping core.

--
http://www.howtobuyamerican.com/
Nov 14 '05 #8
nrk <ra*********@devnull.verizon.net> spoke thus:
I seriously doubt if there's a man page for core on a Linux system.


FWIW, the NetBSD system I'm on does have a man page for core, so who
knows...?

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 14 '05 #9
nrk <ra*********@devnull.verizon.net> wrote in message news:<bL***************@nwrddc02.gnilink.net>...
rahul dev wrote:
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message
news:<bu**********@oravannahka.helsinki.fi>...
ken <ke*@nospam.com> scribbled the following:
> hello,
> i'm writing a c program on a linux system. i'm debugging a segmentation
> fault but i don't want it to dump a core file because the memory
> footprint of the program is over 300Mb and i don't need it to generate
> a 300Mb file every time I add a new printf statement to debug the code. can i do something to prevent it from dumping the core file even when
> it seg faults? (is this a unix/linux thing, or a c thing?)

It's a Unix/Linux thing.


It is indeed a linux thing. C has nothing to do with dumping a core
file.
The linux kernel writes out a file containing a core image of a
terminated process when certain signals are received. The core image
file is written
in the process's working directory. For more information you may
see the man page of core.


I seriously doubt if there's a man page for core on a Linux system.
To prevent it from dumping the core file,you may create a directory
named
"core" in your working directory.


A better(?) solution is to use the ulimit (bash) or limit (csh/tcsh)
builtins to set the limit for coredumpsize to 0. To OP: man bash and
search for ulimit to see how this can be done.

-nrk


Another way is to symbolically link "core" to "/dev/null".
For those who don't need to search for ulimit in the man pages.
Nov 14 '05 #10
In <6d**************************@posting.google.com > ra***********@hotmail.com (rahul dev) writes:
nrk <ra*********@devnull.verizon.net> wrote in message news:<bL***************@nwrddc02.gnilink.net>...
rahul dev wrote:
> Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message
> news:<bu**********@oravannahka.helsinki.fi>...
>> ken <ke*@nospam.com> scribbled the following:
>> > hello,
>> > i'm writing a c program on a linux system. i'm debugging a segmentation
>> > fault but i don't want it to dump a core file because the memory
>> > footprint of the program is over 300Mb and i don't need it to generate
>> > a 300Mb file every time I add a new printf statement to debug the code.

>> > can i do something to prevent it from dumping the core file even when
>> > it seg faults? (is this a unix/linux thing, or a c thing?)
>>
>> It's a Unix/Linux thing.
>
> It is indeed a linux thing. C has nothing to do with dumping a core
> file.
> The linux kernel writes out a file containing a core image of a
> terminated process when certain signals are received. The core image
> file is written
> in the process's working directory. For more information you may
> see the man page of core.


I seriously doubt if there's a man page for core on a Linux system.
> To prevent it from dumping the core file,you may create a directory
> named
> "core" in your working directory.


A better(?) solution is to use the ulimit (bash) or limit (csh/tcsh)
builtins to set the limit for coredumpsize to 0. To OP: man bash and
search for ulimit to see how this can be done.


Another way is to symbolically link "core" to "/dev/null".
For those who don't need to search for ulimit in the man pages.


That's a stupid solution: not only does it require the link in every
directory you use for running programs, but it also doesn't prevent the
kernel from generating the code dump, it's just that the core dump gets
lost into the bit bucket and the system resources used to generate it are
simply wasted.

The right thing is the [u]limit builtin command of the modern Unix
shells.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #11

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

Similar topics

5
by: Ganesh Gella | last post by:
Hi All, I am using g++ on Linux, and my code has lot of vectors each stores a particualr type of structure. (Structure internally had some vectors). When I am trying to push_back an element to...
1
by: Martin | last post by:
I got a core from my client but i am not able to find out where it crashed. I got the following: From my experience, when i got lots of warning which complains about the path mismatch.. I can...
6
by: Greg Brant | last post by:
Hi, how can i backup a table / entire DB and get the index's as well as the data / create table's etc cheers Greg
1
by: Martin | last post by:
I use dbx and i got the following error: Reading GL_CliConnMgr core file header read successfully Reading ld.so.1 dbx: core file read error: address 0xff3e6000 not available dbx: core file...
25
by: Dave Turner | last post by:
I know that its impossible to completely prevent somebody from ripping a site (or cracking software) if that person has the skills and the time/patience, but there are tricks that can be employed...
7
by: L Mehl | last post by:
Hello -- In a form text field for entering stock symbols, I want to allow only: alpha integer decimal backspace left and right arrows delete shift
5
by: su | last post by:
to find which process dumped core at the promt we give $ file core.28424 core.28424: ELF 32-bit LSB core file of 'soffice.bin' (signal 11), Intel 80386, version 1 (SYSV), from 'soffice.bin' ...
15
by: John Nagle | last post by:
I've been installing Python and its supporting packages on a dedicated server with Fedora Core 6 for about a day now. This is a standard dedicated rackmount server in a colocation facility,...
2
by: Zach | last post by:
I compiled a game client and it crashed (segmentation fault) resulting in a core file being generated. I'm trying to find out exactly what caused it to crash. Any ideas how I can do this with gdb?...
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: 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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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...
0
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...

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.