Tuesday, 12 June 2012

How to increase core size in HPUX/LINUX

First, lets us see what actually core dump is:


In computing, a core dumpmemory dump, or storage dump consists of the recorded state of the working memory of a computer program at a specific time, generally when the program has terminated abnormally or crashed. In practice, other key pieces of program state are usually dumped at the same time, including the processor registers, which may include the program counter and stack pointer, memory management information, and other processor and operating system flags and information. Core dumps are often used to assist in diagnosing and debugging errors in computer programs.


As a Tester Sometimes you need to analyze core dump to see if it contains valid information or not so that it can be attached with Bug Ticket.
Sometimes core dump gets truncated because the memory assigned to core is smaller that the generated core file, in this case core dump will be hardly of any use. so we need to increase it.


Lets see how to check the memory assigned to core, for this there is "ulimit -a"
/users/local $ ulimit -a
time(seconds)        unlimited
file(blocks)         unlimited
data(kbytes)         1048576
stack(kbytes)        10000
memory(kbytes)       unlimited
coredump(blocks)     4194303


There are times when core dump is huge and need more of  space, this can be done by changing it to unlimited,
ulimit -c unlimited 


Now, again execute 
 ulimit -a



/users/local $  ulimit -a
time(seconds)        unlimited
file(blocks)         unlimited
data(kbytes)         2097152
stack(kbytes)        10000
memory(kbytes)       unlimited
coredump(blocks)     unlimited




As here,it  can be seen its increased to unlimited.


Point to note  here is, its per session change, if user logout of this session then this will again be changed to the intial value.



/users/local $ ulimit -a
time(seconds)        unlimited
file(blocks)         unlimited
data(kbytes)         1048576
stack(kbytes)        10000
memory(kbytes)       unlimited
coredump(blocks)     4194303

So, how we can increase it for all sessions?


Here is the solution for it:


1).Login with rootuser.
2). Change directory to "/etc"    (cd /etc)
3).Open "profile" file and add this line there  

ulimit -c unlimited



4) Execute profile 

. ./profile


This will make sure that your core dump size remain unlimited for all sessions.




No comments:

Post a Comment