Q: Can Fortran and C memory allocation coexist?

From: Marcel Beekveld (marcel.beekveld_at_imtech.nl)
Date: 11/24/03


Date: 24 Nov 2003 02:30:28 -0800

Hi,

The problem I have concerns mixing C and Fortan code in which memory
is allocated both by the Fortran as well as the C code. Memory that is
allocated in Fortran is also deallocated in Fortran. The same is true
for the C code. Nevertheless I have a hunch that the Fortran and C
memory allocators clash because the compiled Fortran and C code are
part of the same process, and therefore share the same heap. Do the
Fortran and C memory allocators clash or should I look for another
reason?

And if they do clash, what would be a viable solution? I am stuck with
the task of writing a Fortran wrapper for a C library. The C library
does some memory allocation as well as the Fortran code that will be
using the library. Does it mean inter-process communication so that
the processes no longer share the same heap? I am using HP f90 and HP
C compilers on HP-UX.

Thanx,

Marcel.



Relevant Pages

  • Re: allocatable non-dummy local variables and pointers to them
    ... must release the memory used by a process when the process terminates. ... I do remember that Fortran Powerstation 4.0 did have a memory leak ... digging to find whether it claims to be an f90 or f95 compiler. ... compiler has to behave for allocatables that get undefined allocation ...
    (comp.lang.fortran)
  • Re: Q: Can Fortran and C memory allocation coexist?
    ... > The problem I have concerns mixing C and Fortan code in which memory ... > is allocated both by the Fortran as well as the C code. ... > memory allocators clash because the compiled Fortran and C code are ... uses the malloc family of routines to allocate heap space. ...
    (comp.lang.fortran)
  • Re: Handling large datasets in Fortran
    ... Obviously, when you have too much data to fit in memory, you have to ... I have read that Fortran has exceptional abilities in the ... I then need to retrieve comparisons for a set of ... and subset the internal file using intrisics like WHERE and PACK? ...
    (comp.lang.fortran)
  • Re: segmentation fault on calloc
    ... It was written in Fortran and later translated by someone in C. ... segmentation comes in vcalc when it is called by my fortran sub. ... of calloc, it failed... ... Maybe I am calling my added function in a part that some memory have been ...
    (comp.unix.programmer)
  • Re: Writing output files to memory
    ... your data lives in memory. ... > Intel Fortran compiler. ... > party program to ... won't see any difference between a ramdisk and a normal disk. ...
    (comp.lang.fortran)