Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
* weird behavior of malloc()
@ 2001-01-10 22:43 rwgk
  2001-01-11  0:09 ` Terrance Richard Boyes
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: rwgk @ 2001-01-10 22:43 UTC (permalink / raw)


System:
Red Hat Linux release 6.2 (Zoot)
Kernel 2.2.14-6.0smp on a 2-processor alpha

On this system, malloc() returns pointers to places in memory that
are very far apart. For example, one call returns 0x125f77510,
and the next one 0x20000002010 (the first call only allocates
16 bytes or so, the second one about 160000 bytes).

Unfortunately, this behavior is causing us problems. For use in
a Fortran program, we compute the difference between the pointers
returned by malloc() and a pointer to a Fortran reference array.
The difference is divided by the size of Fortran INTEGER, and
that result passed back from C to Fortran as a Fortran INTEGER.
If the difference is too large for INTEGER, our program crashes.

Our program is very large (>100000 lines) and it is practically
impossible to find and replace all INTEGER that store offsets for
dynamic memory allocation. Also, the program is running fine
on another 64-bit architecture (IRIX64). Why does malloc() on
the Alpha return pointers to places in memory that are so far
apart? Could this be changed?

Thanks for any comments,
        Ralf


Sent via Deja.com
http://www.deja.com/


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

end of thread, other threads:[~2001-01-11 18:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-10 22:43 weird behavior of malloc() rwgk
2001-01-11  0:09 ` Terrance Richard Boyes
2001-01-11  2:28 ` Larry Zimmerman
2001-01-11 16:38   ` Greg Lindahl
2001-01-11 16:07 ` Pierre Asselin
2001-01-11 18:25 ` T. Daniel Crawford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox