Re: Fortran and .NET (C#)



apm wrote:
Both Fortran pointers and allocatable arrays allow dynamic allocation. It is the dynamic allocation that can lead to memory leaks.

But it's not. Fortran allocatable arrays, unlike Fortran pointers, cannot have memory leaks.


In general, dynamic allocation does not lead to memory leaks. What leads to memory leaks (or to the need for garbage collection mechanisms) is the ability to dereference a pointer without necessarily deallocating the associated memory.

This is a crucial difference between Fortran and many other languages: Fortran offers options for dynamic memory allocation that do not involve dereferencable pointers, and thus do not have memory leaks.

- Brooks


-- The "bmoses-nospam" address is valid; no unmunging needed. .



Relevant Pages

  • Re: Creating objects
    ... If you need dynamic allocation of objects ... and you don't have to remember to clean up these ... object you won't get memory leaks. ... > unknown until runtime, probably it is not a good idea to create like: ...
    (comp.lang.cpp)
  • Re: Most likely place for a program to be leaking memory?
    ... Lahey's Fortran compiler is supposed to be quite good at diagnosing ... potential problems, and they have a "demo" online where you can submit ... Fortran has a lot fewer potential places for memory leaks than C, ...
    (comp.lang.fortran)
  • Re: Allocatable Components of Derived Type
    ... Fortran was the only ... one which required that the local variable of the derived type be ... Allocatables ... don't cause memory leaks. ...
    (comp.lang.fortran)