MantisBT - ITK
View Issue Details
0010252ITKpublic2010-02-08 11:332011-06-30 16:14
monica hernandez 
kentwilliams 
normalmajorunable to reproduce
closedfixed 
ITK-3-16 
 
backlog
0010252: MemoryProbesCollectorBase does not work properly in my machine
I am trying to use the class itk::MemoryProbesCollectorBase in order to
track the memory usage of my ITK based code. I am getting some weird
results, for example, my code takes 1Gb of memory usage (using top command). However the report does not provide such information. In addition
I am getting negative results of memory usage in specific locations of
my code.

I used this code below in order to allocate some memory and see if the
memory collector works fine for a simpler code. However, the report says
that the process takes 0 Kb of memory usage.

I am working on a Suse 11.0 64 bits machine.

int main( int argc, char **argv )
{
  itk::MemoryProbesCollectorBase mcollector;

  mcollector.Start( "Update" );

  size_t numberOfBytes = atol(argv[1] );
  char * buffer = new char[numberOfBytes];

  mcollector.Stop( "Update" );
  mcollector.Report();

  delete [] buffer;

  return 0;
}



Luis IbaƱez told me that the problem could be located at

Insight/Utilities/kwsys/SystemInformation.cxx

so maybe this class would be the starting point.

No tags attached.
Issue History
2010-02-08 11:33monica hernandezNew Issue
2010-11-02 14:00Hans JohnsonStatusnew => assigned
2010-11-02 14:00Hans JohnsonAssigned To => Luis Ibanez
2010-11-07 03:00Luis IbanezAssigned ToLuis Ibanez => Gabe Hart
2011-06-17 12:49Hans JohnsonAssigned ToGabe Hart => kentwilliams
2011-06-17 12:50Hans JohnsonNote Added: 0026900
2011-06-21 11:22kentwilliamsNote Added: 0026939
2011-06-24 16:32kentwilliamsNote Added: 0026968
2011-06-30 16:14kentwilliamsSprint Status => backlog
2011-06-30 16:14kentwilliamsNote Added: 0027000
2011-06-30 16:14kentwilliamsStatusassigned => closed
2011-06-30 16:14kentwilliamsResolutionopen => fixed

Notes
(0026900)
Hans Johnson   
2011-06-17 12:50   
Please convert this into a test, added it to the module.
Also add a delay in seconds (e..g. 10 seconds) between the Start and Stop calls.
(0026939)
kentwilliams   
2011-06-21 11:22   
I pushed a patch that implements the suggested test. I think that the delays are unnecessary -- they don't change anything about the process or its memory usage, and the MemoryProbe class only samples when you call stop.

See this patch http://review.source.kitware.com/#change,1958 [^]
(0026968)
kentwilliams   
2011-06-24 16:32   
http://review.source.kitware.com/#change,1958 [^] -- now actually works on OS X and Linux.
(0027000)
kentwilliams   
2011-06-30 16:14   
change pushed to ITK