Jose Manuel Cuadra Troncoso
2017-05-15 18:42:31 UTC
Hi,
I have observed discrepancies in memory usage reported by MitkWorkbench
on different operating systems. You can read memory usage at bottom
right corner of MitkWorkbench window.
When I just launch MitkWorkbench in Linux, using MITK-2016.03.0
compiled in release mode, an usage of about 1.80 GB is reported. In
Windows, using MITK-2016.03.0 compiled in release mode, 150 MB are
reported. In Mac, using MITK-2016.03.0 compiled in debug mode, 4.70 GB
are reported.
Apps for system monitoring report a MitkWorkbench memory usage of about
240 MB in Linux, 150 MB in Windows and 90 MB in Mac. Therefore, I think
that memory usage is well reported on Windows but it is incorrectly
reported on the other systems.
MitkWorkbench memory usage is reported using the function
GetProcessMemoryUsage() located at
Modules/Core/src/DataManagement/mitkMemoryUtilities.cpp.
In Windows it invokes GetProcessMemoryInfo( hProcess, &pmc,
sizeof(pmc)) and pmc.WorkingSetSize is used to read current working set
size. This is ok, see https://msdn.microsoft.com/es-es/library/windows/
desktop/ms684877(v=vs.85).aspx.
In Linux it reads /proc/self/statm file and it gets the first number
(named size in GetProcessMemoryUsage) in that file. That number
corresponds to total program size. I think the second number (named res
in GetProcessMemoryUsage) should be used instead, it is the resident
set size and it corresponds to the memory usage shown in monitoring
apps. See /proc/[pid]/statm in http://man7.org/linux/man-pages/man5/pro
c.5.html.
In Mac the virtual_size field of the task_basic_info structure is used.
I think the field resident_size should be used instead. See task_info()
in http://nadeausoftware.com/articles/2012/07/c_c_tip_how_get_process_
resident_set_size_physical_memory_use#taskinfoforcurrentresidentsetsize
.
Regards,
Jose Manuel
I have observed discrepancies in memory usage reported by MitkWorkbench
on different operating systems. You can read memory usage at bottom
right corner of MitkWorkbench window.
When I just launch MitkWorkbench in Linux, using MITK-2016.03.0
compiled in release mode, an usage of about 1.80 GB is reported. In
Windows, using MITK-2016.03.0 compiled in release mode, 150 MB are
reported. In Mac, using MITK-2016.03.0 compiled in debug mode, 4.70 GB
are reported.
Apps for system monitoring report a MitkWorkbench memory usage of about
240 MB in Linux, 150 MB in Windows and 90 MB in Mac. Therefore, I think
that memory usage is well reported on Windows but it is incorrectly
reported on the other systems.
MitkWorkbench memory usage is reported using the function
GetProcessMemoryUsage() located at
Modules/Core/src/DataManagement/mitkMemoryUtilities.cpp.
In Windows it invokes GetProcessMemoryInfo( hProcess, &pmc,
sizeof(pmc)) and pmc.WorkingSetSize is used to read current working set
size. This is ok, see https://msdn.microsoft.com/es-es/library/windows/
desktop/ms684877(v=vs.85).aspx.
In Linux it reads /proc/self/statm file and it gets the first number
(named size in GetProcessMemoryUsage) in that file. That number
corresponds to total program size. I think the second number (named res
in GetProcessMemoryUsage) should be used instead, it is the resident
set size and it corresponds to the memory usage shown in monitoring
apps. See /proc/[pid]/statm in http://man7.org/linux/man-pages/man5/pro
c.5.html.
In Mac the virtual_size field of the task_basic_info structure is used.
I think the field resident_size should be used instead. See task_info()
in http://nadeausoftware.com/articles/2012/07/c_c_tip_how_get_process_
resident_set_size_physical_memory_use#taskinfoforcurrentresidentsetsize
.
Regards,
Jose Manuel
--
,.....................................,................................,
: Jose Manuel Cuadra Troncoso : Email: ***@dia.uned.es :
: Dpto. de Inteligencia Artificial : Tel: (+34) 91-398-7144 :
: Univ. Nac. de Educacion a Distancia : Fax: (+34) 91-398-9382 :
: Juan del Rosal, 16 - 3ª : :
: E-28040 Madrid SPAIN : http://www.ia.uned.es/~jmcuadra:
'.....................................:................................'
,.....................................,................................,
: Jose Manuel Cuadra Troncoso : Email: ***@dia.uned.es :
: Dpto. de Inteligencia Artificial : Tel: (+34) 91-398-7144 :
: Univ. Nac. de Educacion a Distancia : Fax: (+34) 91-398-9382 :
: Juan del Rosal, 16 - 3ª : :
: E-28040 Madrid SPAIN : http://www.ia.uned.es/~jmcuadra:
'.....................................:................................'