Re: Fortran and .NET (C#)
- From: Rich Townsend <rhdt@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 27 Sep 2005 17:31:28 -0400
Richard E Maine wrote:
In article <Vvh_e.24109$nq.10607@lakeread05>, "apm" <Contributor@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
"Richard E Maine" <nospam@xxxxxxxxxxxxx> wrote in message news:nospam-0B071C.12183427092005@xxxxxxxxxxxxxxxxxxxxx
pointers (both in C and in Fortran) are subject to memory leak problems. In contrast, you can't generate a memory leak with a Fortran array that isn't a pointer, no matter how hard you try.
Both Fortran pointers and allocatable arrays allow dynamic allocation. It is the dynamic allocation that can lead to memory leaks.
That is an overly broad generalization which is false. You are attempting to generalize your previous experience with a particular style of dynamic memory allocation. The generalization doesn't hold.
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.
Further to Richard's remarks above, I should point out that my ISO_VARYING_STRING implementation (Google is your friend) contains a number of ALLOCATE() statements, but not a single DEALLOCATE(). Yet, the strength of the implementation is that it will NEVER leak even a single bit of memory (unless of course there is a bug in the compiler, but then all bets are off). The leak free guarantee is nothing to do with my coding skills, and eveything to do with the way in which ALLOCATABLE variables work.
cheers,
Rich .
- 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: g95 bug with ENTRY
- Next by Date: Re: Fortran and .NET (C#)
- Previous by thread: Re: Fortran and .NET (C#)
- Next by thread: Re: Fortran and .NET (C#)
- Index(es):
Relevant Pages
|