- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have converted a publicly available fortran simulation into a subroutine within a C project. I am encountering steadily increasing memory usage with each call to the routine. Running Inspector with the 'memory leaks' option produced no problems. I think there may be an issue with the use of pointers and the SAVE declaration attribute within a module of the subroutine. Do I need to manually deallocate every allocatable array and targets of pointers before returning from the subroutine? What is the most thorough way of clearing up all memory usage at the end of each simulation run? All local allocatable arrays will be deallocated once the routine exits, correct?
Here is an example of the module:
MODULE VDFMODULE
INTEGER, SAVE, POINTER ::MT3DRHOFLG
INTEGER, SAVE, POINTER ::MFNADVFD
INTEGER, SAVE, POINTER ::NSWTCPL
INTEGER, SAVE, POINTER ::IWTABLE
INTEGER, SAVE, POINTER ::NSRHOEOS
REAL, SAVE, POINTER ::DENSEMIN
REAL, SAVE, POINTER ::DENSEMAX
REAL, SAVE, POINTER ::DENSEREF
REAL, SAVE, POINTER ::FIRSTDT
REAL, SAVE, POINTER ::DNSCRIT
REAL, SAVE, POINTER ::DRHODPRHD
REAL, SAVE, POINTER ::PRHDREF
REAL, SAVE, POINTER ::HDRY
REAL, SAVE, POINTER ::HNOFLO
INTEGER, SAVE, POINTER, DIMENSION(:) ::MTRHOSPEC
REAL, SAVE, POINTER, DIMENSION(:,:,:) ::PS
REAL, SAVE, POINTER, DIMENSION(:,:,:) ::RHOCR
REAL, SAVE, POINTER, DIMENSION(:,:,:) ::RHOCC
REAL, SAVE, POINTER, DIMENSION(:,:,:) ::RHOCV
REAL, SAVE, POINTER, DIMENSION(:,:,:) ::HSALT
REAL, SAVE, POINTER, DIMENSION(:,:,:) ::ELEV
REAL, SAVE, POINTER, DIMENSION(:,:,:) ::DCDT
REAL, SAVE, POINTER, DIMENSION(:,:,:,:) ::COLDFLW
REAL, SAVE, POINTER, DIMENSION(:,:,:) ::PSOLDITER
REAL, SAVE, POINTER, DIMENSION(:) ::DRHODC
REAL, SAVE, POINTER, DIMENSION(:) ::CRHOREF
TYPE VDFTYPE
INTEGER, POINTER ::MT3DRHOFLG
INTEGER, POINTER ::MFNADVFD
INTEGER, POINTER ::NSWTCPL
INTEGER, POINTER ::IWTABLE
INTEGER, POINTER ::NSRHOEOS
REAL, POINTER ::DENSEMIN
REAL, POINTER ::DENSEMAX
REAL, POINTER ::DENSEREF
REAL, POINTER ::FIRSTDT
REAL, POINTER ::DNSCRIT
REAL, POINTER ::DRHODPRHD
REAL, POINTER ::PRHDREF
REAL, POINTER ::HDRY
REAL, POINTER ::HNOFLO
INTEGER, POINTER, DIMENSION(:) ::MTRHOSPEC
REAL, POINTER, DIMENSION(:,:,:) ::PS
REAL, POINTER, DIMENSION(:,:,:) ::RHOCR
REAL, POINTER, DIMENSION(:,:,:) ::RHOCC
REAL, POINTER, DIMENSION(:,:,:) ::RHOCV
REAL, POINTER, DIMENSION(:,:,:) ::HSALT
REAL, POINTER, DIMENSION(:,:,:) ::ELEV
REAL, POINTER, DIMENSION(:,:,:) ::DCDT
REAL, POINTER, DIMENSION(:,:,:,:) ::COLDFLW
REAL, POINTER, DIMENSION(:,:,:) ::PSOLDITER
REAL, POINTER, DIMENSION(:) ::DRHODC
REAL, POINTER, DIMENSION(:) ::CRHOREF
END TYPE
TYPE(VDFTYPE),SAVE:: VDFDAT(10)
END MODULE VDFMODULE
Thank you
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
![](/skins/images/045A6C88D0527A93E76B179D7F5E2AFE/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page