LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ulimit -c does not limit the core file size after a particular point (https://www.linuxquestions.org/questions/linux-newbie-8/ulimit-c-does-not-limit-the-core-file-size-after-a-particular-point-589069/)

meetolnx 10-03-2007 04:39 AM

ulimit -c does not limit the core file size after a particular point
 
Iam using redhat enterprise server 5 and I have a issue.
Iam using a binary to dump core file upto a size of 30 MB.
I set ulimit -c 5120 to limit the core file size to 20MB through command line.Now I run the binary to dump core.But its not working and the full 30MB file is written.
Till ulimit -c 52 the command works and after this whatever value I give the full core file is written.Any Idea what may be the problem ?

jailbait 10-03-2007 01:20 PM

Quote:

Originally Posted by meetolnx (Post 2911552)
Iam using redhat enterprise server 5 and I have a issue.
Iam using a binary to dump core file upto a size of 30 MB.
I set ulimit -c 5120 to limit the core file size to 20MB through command line.Now I run the binary to dump core.But its not working and the full 30MB file is written.
Till ulimit -c 52 the command works and after this whatever value I give the full core file is written.Any Idea what may be the problem ?

The -c parameter is specified as 1024 byte increments. So if you want to set the limit to 20MB then you need:

ulimit -c 20480

-----------------
Steve Stites

meetolnx 10-04-2007 12:08 AM

Quote:

Originally Posted by jailbait (Post 2912046)
The -c parameter is specified as 1024 byte increments. So if you want to set the limit to 20MB then you need:

ulimit -c 20480

-----------------
Steve Stites



Still the core file exceeds the ulimit value

I use the following code to dump core,

char *value = (char *)malloc(30*1024*1024)
char *invalid = NULL

*invalid=1

after I set ulimit -c 20480 , i get a core file
-rw------- 1 root root 31510528 Oct 4 10:26 core.484


All times are GMT -5. The time now is 05:28 PM.