Purpose

The module MemoryTracer is a debugging tool to record and analyze memory usage of the current process. If it is activated, it logs all memory allocations and frees and the amount of allocated and freed memory. It also checks whether safety margins around allocated memory blocks are affected, i.e., whether algorithms exceed valid memory borders.

Important notes

  • Note that all memory allocations of the entire process are logged - this includes string operations as well as data structure resizes, window operations, scripting operations, and many more. Even simple button presses or mouse movements to (de)activate the memory recording already cause memory operations. Therefore, memory logging will nearly always detect an asymmetric number of allocation/frees and memory sizes. It is up to the user to identify whether these differences are significant or not. See the fields Maximum Allocation Difference, Maximum Memory Difference, and Min Chunk Size To Log to reduce these effects.
  • This module is only functional in debug mode on Windows systems. All other systems are not supported.

Windows

Default Panel

../../../Modules/ML/MLDiagnosis/mhelp/Images/Screenshots/MemoryTracer._default.png

Parameter Fields

Visible Fields

Start/Stop Logging

name: startStopLogging, type: Trigger

When pressed, the memory counting is started/stopped.

Start/Stop Sleeping

name: startStopSleeping, type: Trigger

When pressed, the memory logging sleeps/awakes.

Logging Is Active

name: loggingIsActive, type: Bool, persistent: no

Shows whether logging is active.

Is Sleeping

name: isSleeping, type: Bool, persistent: no

Shows whether logging is temporarily suspended.

Clear Cache Before After Logging

name: clearCacheBeforeAfterLogging, type: Bool, default: TRUE

If checked, for each (re)allocation, free, and error a table entry is created for a detailed report.

Otherwise, only a summary is generated. Note that recording full information can be memory- and time-intensive.

Record Full Information

name: recordFullInformation, type: Bool, default: FALSE

Do not use!

Still deactivated and still unstable experimental functionality.

It adds more information about (potential) memory leaks in reports. It is significantly more memory- and time-consuming than normal memory tracing.

Record Stack Walks

name: recordStackWalks, type: Bool, default: FALSE

Do not use!

Still deactivated and still unstable experimental functionality.

It adds full stack trace information to (potential) memory leaks in reports. It is significantly more memory- and time-consuming than normal memory tracing.

Post Error On Differences

name: postErrorOnDifferences, type: Bool, default: FALSE

If checked, an error is posted to the ML error handled if any memory or allocation difference is exceeded.

Maximum Allocation Difference

name: maximumAllocationDifference, type: Integer, default: 0

Sets the maximum allowed limit between allocations and deallocations between logging start and stop.

Maximum Memory Difference

name: maximumMemoryDifference, type: Integer, default: 0

Sets the maximum allowed limit between allocated bytes between logging start and stop.

Maximum Report Size

name: maximumReportSize, type: Integer, default: 25000

Sets the maximum allowed size of the generated full report in characters.

Min Chunk Size To Log

name: minChunkSizeToLog, type: Integer, default: 0

Sets the minimum size a memory chunk must have to be logged.

Useful to suppress logging of small memory (de)allocations.

Status

name: status, type: String, persistent: no

Shows general module information and results.

Hidden Fields

enableAll

name: enableAll, type: Bool, persistent: no