Mailinglist Archive: opensuse (3378 mails)

< Previous Next >
gcc compiler ... BUG or MISUSE ????
  • From: Maura Edelweiss <memonvil@xxxxxxxxxxxxxxxx>
  • Date: Thu, 18 Apr 2002 15:17:24 -0500
  • Message-id: <3CBF29D4.14D1F3D4@xxxxxxxxxxxxxxxx>

I' trying to develop a simulation that unluckily requires dynamic memory
I allocate three 1-D vectors and two 2-D arrays.
At run time the programs runs fine as long as I do not need to
reallocate (to increase the space of) the 2-D array called "Ibox".
Whenever I try to reallocate "Ibox" I get a Segmentation Fault from a
system routine "memcpy /lib/".
If I make the initial arrays very big so that no reallocation is
necessary then the programs runs to the end with no problem at all.
However, I relunctantly consider this option as the amount of memory
required depends upon the size of the reals system being simulated.
Hence any hard-coded allocated memory size would as a consequence limit
the usefulness of the program itselt.
I'll be sending three separate messages with one attached snapshot each:
Realloc0.png shows how memory for "Ibox" is allocated the first time.
Realloc1.png shows a failing attempt to realloc "Ibox"
Realloc2.png shows another failing attempt to realloc "Ibox"
Please, notice that all these arrays are STATIC GLOBAL variables as
declared outside any routine. Changing their type from STATIC GLOBAL to
AUTOMATIC is not possible as the contents of those arrays must be
available to the program all its life long !

I would appreciate any suggestion and or comment about this problem.
Thank you in advance for your attention.

best regards,
Maura E.M.

< Previous Next >