strange memory leak

Tobias Burnus burnus@net-b.de
Wed Oct 18 20:58:00 GMT 2006


Hi,

Tobias Burnus wrote:
> I would assume that it is a out of boundary problem (and my gfortran is
> too old to catch it; the hard disc of my workstation is broken and thus
> I cannot test newer gfortrans, NAGf95 etc.).
>   
I re-tested and reconsidered it. It is indeed an array-out-of-bounds
problem,
which the current gfortran nicely detects (with -fbounds-check).

That this check works is great (thanks FX, thanks all) as not all compilers
are able to do so; e.g. ifort does not do run-time array shape checks
(with "-check bound") and misses thus this error.

Thus, your fix does not help, it only hides the problem (or not),
depending which part of the memory you are overwriting.

Moreover, I think, "dim=" is wrongly used. (What is does, see quote in
my previous mail.)

Instead of
  integer :: i(1),j(1)
  i=maxloc(abs(diff),dim=1)
  j=maxloc(abs(diff),dim=2)

you might want to do:
  integer :: k(2), i, j
  k = maxloc(abs(diff))
  i = k(1); j = k(2)

(However, I don't know whether this is what your program actually expects.)

Tobias



More information about the Fortran mailing list