- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a possibility to find out how much memory the fortran program uses whne the program is running.
I do not mean the size of the (.exe) program
I mean the size of memony used when the program is running
Klaus
I do not mean the size of the (.exe) program
I mean the size of memony used when the program is running
Klaus
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A basic measure is the image size, and that can be obtained at the command line:
C:\ > dumpbin /headers.exe
You can watch the time-dependent memory consumption by locating your application processes in the Task Manager. There are other tools for "process monitoring".
As a program allocates variables on the heap, loads DLLs, and chains calls on the stack, naturally memory consumption is dynamic.
C:\ > dumpbin /headers
You can watch the time-dependent memory consumption by locating your application processes in the Task Manager. There are other tools for "process monitoring".
As a program allocates variables on the heap, loads DLLs, and chains calls on the stack, naturally memory consumption is dynamic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok thanks
I was hoping, that there is a possibility within the program
Some kind of a compiler option or fortran call or.....
thanks
Klaus
I was hoping, that there is a possibility within the program
Some kind of a compiler option or fortran call or.....
thanks
Klaus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could try looking at GlobalMemoryStatusEX
for example something like :
[bash]module memory_System implicit none private ! Parameters ! Used to return data in Mb (ie divide by (1024 * 1024)) real*8, parameter :: m_dbDivide = 1024 * 1024; ! Variables integer*4, public :: m_dwMemLength integer*4, public :: m_dwMemLoad real*8, public :: m_dbMemTotalPhys real*8, public :: m_dbMemAvailPhys real*8, public :: m_dbMemTotalPageFile real*8, public :: m_dbMemAvailPageFile real*8, public :: m_dbMemTotalVirtual real*8, public :: m_dbMemAvailVirtual ! Subroutines public:: GetMemoryStats contains !------------------------------------------------------------------ ! Subroutines subroutine GetMemoryStats() use kernel32 IMPLICIT NONE type(T_MEMORYSTATUSEX) lpMstMemStat lpMstMemStat.dwLength = sizeof(lpMstMemStat) if (GlobalMemoryStatusEx(lpMstMemStat)==0) then !error m_dwMemLength = 0 m_dwMemLoad = 0 m_dbMemTotalPhys = 0.0 m_dbMemAvailPhys = 0.0 m_dbMemTotalPageFile = 0.0 m_dbMemAvailPageFile = 0.0 m_dbMemTotalVirtual = 0.0 m_dbMemAvailVirtual = 0.0 else m_dwMemLength = lpMstMemStat.dwLength m_dwMemLoad = lpMstMemStat.dwMemoryLoad m_dbMemTotalPhys = fnUlltoR8(lpMstMemStat.ullTotalPhys) / m_dbDivide m_dbMemAvailPhys = fnUlltoR8(lpMstMemStat.ullAvailPhys) / m_dbDivide m_dbMemTotalPageFile = fnUlltoR8(lpMstMemStat.ullTotalPageFile) / m_dbDivide m_dbMemAvailPageFile = fnUlltoR8(lpMstMemStat.ullAvailPageFile) / m_dbDivide m_dbMemTotalVirtual = fnUlltoR8(lpMstMemStat.ullTotalVirtual) / m_dbDivide m_dbMemAvailVirtual = fnUlltoR8(lpMstMemStat.ullAvailVirtual) / m_dbDivide end if return end subroutine GetMemoryStats
real*8 function fnUlltoR8(nIn) use ifwinty implicit none type(T_LARGE_INTEGERX), intent(in) :: nIn integer*8 nI8 integer*4 nBits integer*8 nLow, nHigh !----------------------------------------------------------------------| nbits = 0 !do low if (nIn.LowPart < 0) then nBits = bit_size(nIn.LowPart) nLow = (int8(nIn.LowPart) + 2_8**nBits) else nLow = nIn.LowPart endif !do high if (nIn.HighPart < 0) then nBits = bit_size(nIn.HighPart) nHigh = (int8(nIn.HighPart) + 2_8**nBits) else nHigh = nIn.HighPart endif !combine the data nHigh=ISHFT(nHigh,32_8) nI8=nHigh+nLow fnUlltoR8=nI8 end function fnUlltoR8 [/bash]
end module memory_System
Hope this helps
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry I'm not sure how the
Les
andstuff got there. I was trying to add in a function I had missed out in my cut and paste. Just ignore those lines.
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are multiple issues at play here (to find out how much memory the fortran program uses whne the program is running).
There is the issue of the memory requirements for the code plus static data, plus stack data, plus allocated memory.
Then there is the issue of memory footprint which includes the above plus voids (previously allocated but now returned memory).
The memory foot print is effectively the Virtual Memory requirements of the application. (think of this as "squatting" memory).
The former requirement (sans voids) would be your "working" memory.
Les's suggestion as well as using other heap walk (diagnostic debug routines) can be used to determine heap size and allocations.
It is not unusual for some applications to experience Virtual Memory creap while having a relatively steady working memory requirement (consistantly fragmenting the heap).
Jim Dempsey
There is the issue of the memory requirements for the code plus static data, plus stack data, plus allocated memory.
Then there is the issue of memory footprint which includes the above plus voids (previously allocated but now returned memory).
The memory foot print is effectively the Virtual Memory requirements of the application. (think of this as "squatting" memory).
The former requirement (sans voids) would be your "working" memory.
Les's suggestion as well as using other heap walk (diagnostic debug routines) can be used to determine heap size and allocations.
It is not unusual for some applications to experience Virtual Memory creap while having a relatively steady working memory requirement (consistantly fragmenting the heap).
Jim Dempsey

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page