By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,569 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

prevent dumping core file?

P: n/a
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
Share this Question
Share on Google+
10 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.