[QuickTips]Enable core dump in a terminal

Some times we need our application to create core dump  when it crashes during development. You can easily enable this using “ulimit -c unlimited”.

To enable core dump in a terminal, you have to set the core file size variable. When this variable is set to zero, core dump is not created for a crashed application. This variable specifies the maximum size of a core dump file. You can check the value of this variable by using the command: ‘ulimit -a’

➜  ~ ulimit -a

-t: cpu time (seconds)              unlimited
-f: file size (blocks)              unlimited
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             8192
-c: core file size (blocks)     0  => Variable to consider
-v: address space (kbytes)          unlimited
-l: locked-in-memory size (kbytes)  unlimited
-u: processes                       709
-n: file descriptors                256
➜  ~  

To set core file size, you can use the following command: ‘ulimit -c unlimited’.
Verify again by using the  ‘ulimit -a’ command.

➜  ~ ulimit -a

-t: cpu time (seconds)              unlimited
-f: file size (blocks)              unlimited
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             8192
-c: core file size (blocks)     unlimited  => new value
-v: address space (kbytes)          unlimited
-l: locked-in-memory size (kbytes)  unlimited
-u: processes                       709
-n: file descriptors                256
➜  ~  

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s