Hello all,
I am having some serious (and irritating) problems porting some
relatively simple ANSI C code to OSF/1 3.0. I use dynamic memory
allocation heavily throughout the code, i.e. lots of calloc() calls,
and most of these for small amounts of memory which are then
enlarged using realloc() calls. There is a lot of calloc()/free()
activity throught the program.
Now, on Suns (SunOS 4.1.3, gcc 2.7.0) the programs compile and run
fine, even using Purify. On Linux boxes (gcc 2.7.0) same thing,
runs fine even under Electric Fence (free Purify version). It even
runs on SGI Irix machines. Under OSF/1 I get one of two things,
either the machine says "Out of memory" after I have allocated
about 100*sizeof(int) (this varies unfortunately) or I get a nice
SIGSEGV in memcpy() with two perfectly valid blocks of memory.
I tried the following:
1) -taso -trapuv on the complier command line. No help
2) Double checking each allocation size - they are all fine and as
expected
3) Stepped through it with gdb and dbx and found calloc() returns
NULL for minute memory requests (I had better add that the
machine is unloaded and with plenty of free RAM/swap)
I have tried isolating the problem and it all stems from a valid
calloc call which returns NULL even when there seems to be plenty
of RAM/swap available. This doesn't occur at the same calloc() call
all the time, it depends on when it "feels like" returning a nice
NULL.
Has anyone seen this happen or have a solution?
Thanks,
Arrigo
--
Arrigo Triulzi <arrigo_at_ic.ac.uk>
Mathematics Dept. Imperial College of Science & Technology - London - UK
Received on Fri Sep 01 1995 - 14:49:05 NZST