On Fri, Feb 18, 2011 at 5:46 PM, [email protected] <[email protected]>wrote:
> > > On Fri, Feb 18, 2011 at 11:14 AM, [email protected] <[email protected] > > wrote: > >> Hi >> >> I was getting segmentation fault in a simple program meant to recursively >> calculate the factorial of a number (>5000). Some digging around revealed >> that it was because the stack size was limited to 1 MB. >> I added this to my /home/<username>/.bashrc >> ulimit -s unlimited >> and voila!! the program successfully calculated it upto 7000. >> >> but after that it is getting bus error ... will get into that today. >> > bus error:- http://bit.ly/gdahmO > It means my program is trying to access memory that is not there. > And sincerely the memory consumption of my program reaches the maximum > limit (saw the inclining graph in system manager) when I calculate the value > for say 7100. > > So I am wondering now why it does not use the swap space? > Linux kernel will consume all the free memory in your system first then start eating up your cache this is because Linux kernel uses the unused free memory as cache memory to increase performance , you can read more about memory management in the classic work "Understanding the Linux Virtual Memory Manager" by Mel Gorman -Satya -- LUG@IITD - http://tinyurl.com/ycueutm
