type :: row1
real*8, dimension), pointer :: A
end type row1
type :: row2
type(row1), dimension), pointer :: B
end type row2
type(row2), dimension), pointer :: C
Do I need to fee this memory?
is nullify(C) enough?
Fortran deallocates automatically only allocatable objects, not pointers. So, if C has been allocated, then nullify(C) is not enough. You must first deallocate each sub-pointer (if allocated) and then deallocate C at the end of the process to free the memory.
@harphool it is usually better to allocate only allocatable objects even if pointer objects may be allocated too. I prefer to use pointers only to point to a memory already allocated.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.