niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » SGI/IRIX
Large array size in C++
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
Author Message
Walter Roberson
*nix forums Guru


Joined: 19 Feb 2005
Posts: 1300

PostPosted: Sat Jul 01, 2006 7:13 am    Post subject: Re: Large array size in C++ Reply with quote

In article <1151731364.454706.270480@p79g2000cwp.googlegroups.com>,
swagat <swagat.kumar@gmail.com> wrote:

Quote:
Have you checked with systune to see what the maximum resources are?

the file '/etc/systune.conf ' contains following information:
--------------------------------------------------------------------------------
# defaults*10 for kernel 2.2
# /proc/sys/fs/file-max:40960

Sorry, I didn't notice the 'prism' part of your question before.
IRIX has a bunch of rlimit_* in systune; I have no idea what the
linux equivilent is. Similarily, the dso man page is for IRIX.

Tony Mantler is correct that large items should not be allocated
on the stack -- but you did not answer my question as to how the
variable was being allocated, so we can't tell yet if his advice
was the best for the situation.
Back to top
Tony 'Nicoya' Mantler
*nix forums Guru Wannabe


Joined: 02 Jul 2005
Posts: 139

PostPosted: Sat Jul 01, 2006 5:38 am    Post subject: Re: Large array size in C++ Reply with quote

In article <1151731364.454706.270480@p79g2000cwp.googlegroups.com>,
"swagat" <swagat.kumar@gmail.com> wrote:

: 'ulimit -a' gives me following output on my system
: ---------------------------------------------------------------------
: $ ulimit -a
: core file size (blocks, -c) 0
: data seg size (kbytes, -d) unlimited
: file size (blocks, -f) unlimited
: max locked memory (kbytes, -l) unlimited
: max memory size (kbytes, -m) unlimited
: open files (-n) 1024
: pipe size (512 bytes, -p) 8
: stack size (kbytes, -s) 8192
: cpu time (seconds, -t) unlimited
: max user processes (-u) unlimited
: virtual memory (kbytes, -v) unlimited
: ---------------------------------------------------------------------------
:
: How do I adjust the 'ulimit' values? I read man page but it does not
: provide much information. Infact, it does not say anything about how
: to use this function.

ulimit is normally a shell builtin, so you'll want to consult the manpage for
your shell to determine how to set different values.

It would appear you're running bash (on linux, would be my guess from the values
you've pasted). I've excerpted the relevant section of the bash manpage below
for your reading convenience.

However, I don't suggest you change the ulimit values. You shouldn't be
allocating huge structures on the stack; I would suggest that the best plan is
to change your code to allocate it on the heap with malloc(3) and friends


: ulimit [-SHacdefilmnpqrstuvx [limit]]
: Provides control over the resources available to the shell and
: to processes started by it, on systems that allow such control.
: The -H and -S options specify that the hard or soft limit is set
: for the given resource. A hard limit cannot be increased once
: it is set; a soft limit may be increased up to the value of the
: hard limit. If neither -H nor -S is specified, both the soft
: and hard limits are set. The value of limit can be a number in
: the unit specified for the resource or one of the special values
: hard, soft, or unlimited, which stand for the current hard
: limit, the current soft limit, and no limit, respectively. If
: limit is omitted, the current value of the soft limit of the
: resource is printed, unless the -H option is given. When more
: than one resource is specified, the limit name and unit are
: printed before the value. Other options are interpreted as fol-
: lows:
: -a All current limits are reported
: -c The maximum size of core files created
: -d The maximum size of a process's data segment
: -e The maximum scheduling priority (`nice')
: -f The maximum size of files created by the shell
: -i The maximum number of pending signals
: -l The maximum size that may be locked into memory
: -m The maximum resident set size
: -n The maximum number of open file descriptors (most systems
: do not allow this value to be set)
: -p The pipe size in 512-byte blocks (this may not be set)
: -q The maximum number of bytes in POSIX message queues
: -r The maximum rt priority
: -s The maximum stack size
: -t The maximum amount of cpu time in seconds
: -u The maximum number of processes available to a single
: user
: -v The maximum amount of virtual memory available to the
: shell
: -x The maximum number of file locks
:
: If limit is given, it is the new value of the specified resource
: (the -a option is display only). If no option is given, then -f
: is assumed. Values are in 1024-byte increments, except for -t,
: which is in seconds, -p, which is in units of 512-byte blocks,
: and -n and -u, which are unscaled values. The return status is
: 0 unless an invalid option or argument is supplied, or an error
: occurs while setting a new limit.


Cheers - Tony 'Nicoya' Mantler :)

--
Tony 'Nicoya' Mantler - Master of Code-fu
-- nicoya@ubb.ca -- http://www.ubb.ca/ --
Back to top
swagat
*nix forums beginner


Joined: 30 Jun 2006
Posts: 2

PostPosted: Sat Jul 01, 2006 5:22 am    Post subject: Re: Large array size in C++ Reply with quote

Quote:
Have you attempted to adjust your ulimit values at the shell level?

'ulimit -a' gives me following output on my system
---------------------------------------------------------------------
$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
---------------------------------------------------------------------------

How do I adjust the 'ulimit' values? I read man page but it does not
provide much information. Infact, it does not say anything about how
to use this function.


Quote:
Have you checked with systune to see what the maximum resources are?

the file '/etc/systune.conf ' contains following information:
--------------------------------------------------------------------------------
# /etc/systune.conf

# Format:
# <path>:<value>
# <path>:<value>
# ...

# Filesystem tuning

# defaults*10 for kernel 2.0
# /proc/sys/kernel/file-max:10240
# /proc/sys/kernel/inode-max:30720

# defaults*10 for kernel 2.2
# /proc/sys/fs/file-max:40960
# /proc/sys/fs/inode-max:81920
-------------------------------------------------------------------------

other things deal with VM tuning, network tuning, network setting etc.
and I think those things are not relevant to this discussion.

Quote:

Have you used the linker options to reposition the libraries to
give you more room? See the 'dso' man page; if you need to
do the repositioning for an existing executable, see rqs .

'dso' is not available on my system. Can you give me some more
information regarding how can I increase the memory allocated to the
arrays used by c++ programs.

Regards,
swagat
Back to top
Walter Roberson
*nix forums Guru


Joined: 19 Feb 2005
Posts: 1300

PostPosted: Fri Jun 30, 2006 6:59 am    Post subject: Re: Large array size in C++ Reply with quote

In article <1151644162.350979.284950@h44g2000cwa.googlegroups.com>,
swagat <swagat.kumar@gmail.com> wrote:
Quote:
I am trying to run a Neural network program written in C++ on my SGI
prism server. But for a larger array size, it is giving me segmentation
fault.

Is there any where I can make compiler to accept higher array size?

Maybe. Is the array a static variable or an automatic variable
(local to a function), or is it dynamically allocated memory?

Have you attempted to adjust your ulimit values at the shell level?
$ ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 524288
stack(kbytes) 65536
memory(kbytes) 121916
coredump(blocks) unlimited
nofiles(descriptors) 200
vmemory(kbytes) 524288

Have you checked with systune to see what the maximum resources are?

Have you used the linker options to reposition the libraries to
give you more room? See the 'dso' man page; if you need to
do the repositioning for an existing executable, see rqs .
Back to top
swagat
*nix forums beginner


Joined: 30 Jun 2006
Posts: 2

PostPosted: Fri Jun 30, 2006 5:09 am    Post subject: Large array size in C++ Reply with quote

Hi all!

I am trying to run a Neural network program written in C++ on my SGI
prism server. But for a larger array size, it is giving me segmentation
fault.

Is there any where I can make compiler to accept higher array size?



Regards,
swagat
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
The time now is Fri Nov 21, 2008 4:06 am | All times are GMT
navigation Forum index » *nix » SGI/IRIX
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Trouble Declaring 3D Array in Header File free2klim C++ 1 Fri Jul 21, 2006 4:07 am
No new posts determine pointer to point to array or single item during... yancheng.cheok@gmail.com C++ 5 Fri Jul 21, 2006 1:17 am
No new posts FAQ 4.41 How can I remove duplicate elements from a list ... PerlFAQ Server Perl 0 Fri Jul 21, 2006 1:03 am
No new posts how to convert byte array into integer msosno01@gmail.com C++ 3 Thu Jul 20, 2006 9:07 pm
No new posts how to convert byte array into integer msosno01@gmail.com C++ 1 Thu Jul 20, 2006 9:01 pm

Credit Counseling | Actress | Credit Cards | Credit Card Consolidation | MPAA
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.3509s ][ Queries: 20 (0.2536s) ][ GZIP on - Debug on ]