LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2007, 04:01 AM   #1
johnpaulodonnell
Member
 
Registered: Jun 2006
Location: Galway
Distribution: Suse 10.1
Posts: 114

Rep: Reputation: 15
appropriate value for stacksize?


Hi.

I'm getting a segmentation fault when I run a fortran 90 executable. I've been told that a possible remedy would be to increase the stacksize limit...

The executable runs when I decrease the size of the input data files, so an error along these lines would make sense...

But I have no idea to what value I should increase the stacksize limit - I've never done this before...At present it is:
Code:
stack size              (kbytes, -s) 8192
The matrix that I am working with has of the order 100,000,000 entries...can anyone suggest a reasonable value for the stacksize limit? Or would ulimit -s unlimited be the thing to do?

thanks.
 
Old 04-27-2007, 08:33 AM   #2
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,288

Rep: Reputation: 52
I am only answering because you had no reply as yet, I am not sure my thoughts could be of any help.

The stack size depends on what the program does, some programs use it extensively and need a lot of space in the stack while other programs do not and can do with very little.

The old .com assembly programs used to start at 100H and this used to leave 100H bytes for the stack which was plenty for most programs.

Segmentation faults may have nothing to do with the stack but with the addressing. It may be possible that reading too much data for the memory available may fail silently but the subsequent addressing of the data may be outside of data memory and creates a segmentation fault.

In other words, have you got enough memory to store 100.000.000 entries? If these entries are 20 bytes long, you need 2G of memory for data only.

If you know the length of the file you have to store in memory and you have a way of hacking the program, the EAX register always lets know how many bytes have been read after a read() syscall, with a 32 bits OS this will be about 4.2G at the most.

The stack is not normally used to hold data but pointers to data addresses, 8192 KB of stack (8MB) seems to be an awful lot to me, and probably unnecessary.

Also, allocating space for the stack reduces the amount of memory available, so if the stack is not used as much as you think, this is counter-productive.

Hope this helps.

Last edited by rblampain; 04-27-2007 at 08:47 AM.
 
Old 04-27-2007, 10:26 AM   #3
johnpaulodonnell
Member
 
Registered: Jun 2006
Location: Galway
Distribution: Suse 10.1
Posts: 114

Original Poster
Rep: Reputation: 15
thanks for the reply...

increasing the stacksize limit actually did sort out the segmentation fault...and as I'm going to be running the code alot I just added ulimit -s unlimited to .bashrc

My understanding off all these memory issues isn't too good, but as long as the code runs I'm happy!

cheers
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ndiswrapper on Fedora 3 (and 4k stacksize) unzari Linux - Wireless Networking 4 04-25-2005 07:16 AM
rebuild kernel with a stacksize of 8k? Peanutman Fedora 6 03-28-2005 02:20 PM
how do i increase user stacksize? zepplin611 Linux - Newbie 2 08-20-2004 11:28 PM
how to increase stacksize? pthreads and stacksize, winex3 deNiro Slackware 4 11-03-2003 02:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration