The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
decreasing the MAXSSIZE value ! ghadad UNIX for Advanced & Expert Users 1 01-11-2006 07:29 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-03-2008
karthikb23 karthikb23 is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 18
Help with maxssize

Hi,
I read up about maxssiz when having problems with stack overflow.
I check on the below on my HP-UX as:

Parameter Current Dyn Planned Module Version
===============================================================================
maxssiz 0x17000000 - 0X17000000

When using gdb, i check that the value for a local array variable is as follows:

(gdb) print &s[1000000]
$2 = 0x690e7a50 "c"

Does this imply that the memory address is within the max allocated?

Also, how do i interpret the address in dec, again the maxssiz value in dec?

Any help is really appreciated.
Thanks
  #2 (permalink)  
Old 04-03-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,789
gdb :
printf "%d\n", 0x690e7a50

displays a hex value as decimal.

What problem are you having with your code?
  #3 (permalink)  
Old 04-04-2008
karthikb23 karthikb23 is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 18
Hi,
I basically want to ensure that the above message is because of a stack overflow.

On checking maxssiz using sysdef, i get a value: 0-98048.

This is beleive is the value from 0 - The frame base, to 98048.
Also, a kmtune gives me:

Parameter Current Dyn Planned Module Version
===============================================================================
maxssiz 0x17000000 - 0X17000000

I haven't used kmtune before. Does 0X17000000 imply the upper limit of stack address???

So, I wanted to check the value of stack in the core file.

On Sun, this can be done using pmap.
But i cannot find an equivalent command on HP.

And was fiddling around with GDB, to check if i could find some way around with this, on GDB.

Can anyone help please?

Thanks!
  #4 (permalink)  
Old 04-04-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,789
I'm not sure what kind your OS is, but if it is Linux:
Instead of adjusting kernel settings, try looking at the output of ulimit -s.
And see what that says. You probably have a code error.

If you really are blowing the stack - which I doubt - try using heap instead of stack.
In other words make the array a global array, not on the stack. You can do this two ways by:
1. declaring it global
or
2. using malloc to create the storage for the array

Changing kernel parameters is the last and worst choice - what if you want to run the code on another machine?
  #5 (permalink)  
Old 04-09-2008
karthikb23 karthikb23 is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 18
Thanks Jim.
Anyways, i thought that all local variables were allocated on stack.
By what you say, are local arrays (string and int) allocated on heap ?(I know malloc allocates memory on heap).
  #6 (permalink)  
Old 04-09-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,789
Variables declared "outside" a function, global variables, are not on the stack.
malloc does allocate memory in heap.

To see how you code allocates memory now, use the size command. I think

Code:
size -f myprog

will work on your system. Anyway consult the manpage
Closed Thread

Bookmarks

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:32 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0