Re: Memory Leak Problem



e p chandler <epc8@xxxxxxxx> wrote:

12. [I don't understand POINTER in Fortran very well.] Is it standard
to use rout, which has a pointer attribute, as an argument and then
ALLOCATE it inside your subroutine?

Yes - perfectly ordinary and standard. That does require that the dummy
argument also have the pointer attribute and that the procedure have an
explicit interface, but both of those conditions are met.

I doubt I'd have done this problem quite that way, but it is standard
and shouldn't cause problems.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.



Relevant Pages

  • Returning pointers to objects that are not TARGETs in the parent?
    ... This just came up in the gfortran mailing list, and I'd like a sanity check on my reading of the standard. ... subroutine assoc ...
    (comp.lang.fortran)
  • Re: allocating memory from C
    ... and allocate memory to them from inside ... It might be possible within the Fortran 2003 C interoperability ... a Fortran subroutine or function, ... can then pass a pointer as an ALLOCATABLE argument to the C ...
    (comp.lang.fortran)
  • Re: Allocatable derived type with allocatable components in fortran 90
    ... allocate(particledata(N_dim, 2, N_particles)) ... real, dimension, pointer:: position ... subroutine allocateParticle ... Both variable kinds can in fact be ...
    (comp.lang.fortran)
  • Re: allocating memory from C
    ... function to determine the amount to allocate, ... a Fortran subroutine or function, ... can then pass a pointer as an ALLOCATABLE argument to the C ... I would then call a Fortran subroutine from ...
    (comp.lang.fortran)
  • Re: can an allocatable array be really dynamic?
    ... array work like a linklist to allocate a node when needed? ... The Fortran 2003 standard includes an intrinsic which allows for adding to an existing allocatable array without erasing the existing data. ... subroutine allocate_expandable ... Also, since a%data is a pointer rather than an allocatable, you probably also want a deallocate_expandable subroutine. ...
    (comp.lang.fortran)