public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problems with array size limits
@ 2005-01-25 21:11 Daniel Silvestre
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Silvestre @ 2005-01-25 21:11 UTC (permalink / raw)
  To: gcc-help

Greetings GCC people,

I'm having problems in runtime with some programs. First of all, I'm a
newbie programmer with little experience, so any help goes !!
Some months ago, using Mandrake 10.0 community and its version of GCC
I've written some C programs to deal with genomic sequences.
Everything worked very well.
But now, using Mandrake 10.1 Official PP with gcc 3.4.1 or even icc
8.1 the programs compile but don run ! And tracing the problem I've
found:

collect2: ld terminated with signal 11 [Segmentation fault]

I've supposed that must be a problem with arrays size. Testing this
hypothesis showed that the size limits of arrays have changed. When I
reduce some arrays the problem vanishes.

How can I tell my gcc to surpass this size limit?
That's it !!!

Cordially,
Daniel Marques

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Problems with array size limits
@ 2005-01-25 21:41 lrtaylor
  0 siblings, 0 replies; 2+ messages in thread
From: lrtaylor @ 2005-01-25 21:41 UTC (permalink / raw)
  To: jarretinha, gcc-help

You're problem is not due to GCC, but rather is due to the stack size
limit on your OS.  Each OS may have a different limit on how large the
stack can be.  This has a direct effect on how large you can make
statically allocated arrays (e.g., arrays declared as local variables in
functions).  When working with large datasets, it's better to
dynamically allocate the memory for your arrays (using malloc/free in C
or new/delete in C++)so that it gets allocated on the heap.  The only
limitation you have then is the amount of virtual memory available
(physical memory + swap) to your process.

Keep in mind that effective memory management is one of the larger (more
important and easy to screw up) problems when programming in C and C++.
If you don't have much experience in that area, I would recommend
reading up on it first to thoroughly familiarize yourself with the ideas
and techniques involved.

Otherwise, as a temporary work around until you can properly update your
program, you can temporarily adjust the stack size limit for programs on
Linux using the ulimit command.  Just running 'ulimit -s' will show you
what your current setting is.  'ulimit -s <value>' will set it.

Good luck,
Lyle


-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Daniel Silvestre
Sent: Tuesday, January 25, 2005 2:11 PM
To: gcc-help@gcc.gnu.org
Subject: Problems with array size limits

Greetings GCC people,

I'm having problems in runtime with some programs. First of all, I'm a
newbie programmer with little experience, so any help goes !!
Some months ago, using Mandrake 10.0 community and its version of GCC
I've written some C programs to deal with genomic sequences.
Everything worked very well.
But now, using Mandrake 10.1 Official PP with gcc 3.4.1 or even icc
8.1 the programs compile but don run ! And tracing the problem I've
found:

collect2: ld terminated with signal 11 [Segmentation fault]

I've supposed that must be a problem with arrays size. Testing this
hypothesis showed that the size limits of arrays have changed. When I
reduce some arrays the problem vanishes.

How can I tell my gcc to surpass this size limit?
That's it !!!

Cordially,
Daniel Marques


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-01-25 21:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-25 21:11 Problems with array size limits Daniel Silvestre
2005-01-25 21:41 lrtaylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).