Re: Fortran and .NET (C#)
- From: Brooks Moses <bmoses-nospam@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 27 Sep 2005 14:13:24 -0700
Richard E Maine wrote:
Let me repeat for the second time (at least) in this thread, and not counting many times in previous thready. You *CANNOT* leak memory because of a user error with Fortran allocatable arrays. That is an intentional part of the design of Fortran allocatables. It is so much a part of the design, that if you managed to find a way to do it, I am confident that it would be regarded as a bug in the standard and a fix would be published. In the many times I have explained this, not once has anyone come up with a code sample to contradict it.
It occurs to me that one could perhaps argue that Fortran allocatable arrays use a simplistic form of reference-counting garbage collection that can be implemented with zero cost at compile time. Namely, the language does not permit more than one "pointer" (by which I mean allocatable array variable, not a real pointer) to refer to a given piece of memory allocated as an allocatable array, and therefore, when a "pointer" is dereferenced (by going out of scope, or whatever), the compiler can assume the reference count has gone to zero and thus deallocate the memory.
I doubt that this is a helpful way of looking at things, however.
- Brooks
-- The "bmoses-nospam" address is valid; no unmunging needed. .
- Follow-Ups:
- Re: Fortran and .NET (C#)
- From: Richard E Maine
- Re: Fortran and .NET (C#)
- References:
- Fortran and .NET (C#)
- From: apm
- Re: Fortran and .NET (C#)
- From: Richard Maine
- Re: Fortran and .NET (C#)
- From: apm
- Re: Fortran and .NET (C#)
- From: Richard E Maine
- Re: Fortran and .NET (C#)
- From: apm
- Re: Fortran and .NET (C#)
- From: Richard E Maine
- Fortran and .NET (C#)
- Prev by Date: Re: Fortran and .NET (C#)
- Next by Date: Re: g95 bug with ENTRY
- Previous by thread: Re: Fortran and .NET (C#)
- Next by thread: Re: Fortran and .NET (C#)
- Index(es):
Relevant Pages
|