Archived issue #0020212
Implement mechanism for investigation of memory problems
Description
It is proposed to realize a mechanism on the low level (Standard) that allows to
see memory usage statistics when debugging memory-related problems.
The idea is to define a callback function that is to be called from withing
Allocate and Free methods of the class Standard_MMgrOpt. These methods should
pass to that function the kind of current operation, the block address and size.
It is also proposed to realize the default callback function as the static
method of the class NCollection::BaseAllocator, and the function to print memory
usage statistics cumulated by the default callback. This callback is to be used
by anyone who is going to analyze his program memory problems.
By default, callback is not registered and the behavior of the allocator is not
changed.
see memory usage statistics when debugging memory-related problems.
The idea is to define a callback function that is to be called from withing
Allocate and Free methods of the class Standard_MMgrOpt. These methods should
pass to that function the kind of current operation, the block address and size.
It is also proposed to realize the default callback function as the static
method of the class NCollection::BaseAllocator, and the function to print memory
usage statistics cumulated by the default callback. This callback is to be used
by anyone who is going to analyze his program memory problems.
By default, callback is not registered and the behavior of the allocator is not
changed.
Additional information
Documentation remark, added by Author 2008-12-12 12:54:53:
New features:
Foundation Classes.
Memory management in the mode MMGT_OPT=1 has been complemented with a mechanism
that allows to see memory usage statistics when debugging memory-related problems.
This mechanism is based on calling a user callback function from within
Allocate and Free methods of the class Standard_MMgrOpt. These methods pass to
that function the kind of current operation, the block address and its size. The
user can define the callback with the method
Standard_MMgrOpt::SetCallBackFunction. By default no callback is defined.
The class NCollection_BaseAllocator provides the static method StandardCallBack
that the user can use as the callback function. The static method
NCollection_BaseAllocator::PrintMemUsageStatistics can be used to print memory
usage statistics accumulated by StandardCallBack into standard output.
New features:
Foundation Classes.
Memory management in the mode MMGT_OPT=1 has been complemented with a mechanism
that allows to see memory usage statistics when debugging memory-related problems.
This mechanism is based on calling a user callback function from within
Allocate and Free methods of the class Standard_MMgrOpt. These methods pass to
that function the kind of current operation, the block address and its size. The
user can define the callback with the method
Standard_MMgrOpt::SetCallBackFunction. By default no callback is defined.
The class NCollection_BaseAllocator provides the static method StandardCallBack
that the user can use as the callback function. The static method
NCollection_BaseAllocator::PrintMemUsageStatistics can be used to print memory
usage statistics accumulated by StandardCallBack into standard output.
Public activity
No public notes
Participants are labeled by their role within this record.