Please enable JavaScript to view this site.

Memory Validator Help

The Error Reporting tab allows you to check for a few special conditions that can stop the target program using a warning dialog or breakpoint

 

interactiveRead on, or click on a setting in the picture below to find out more

 

error-report-settings

 

 

Memory Errors

 

When allocating CRT memory Memory Validator looks for two conditions that may indicate a programming error, or programming oversight.

 

 

Report allocations of zero size instructionStep enable the detection of zero size allocations showing the warning dialog in the breakpoints topic

 

Zero byte allocations are valid, but not normally something that is done. Bugs come about for example because memory blocks of zero length are allocated and then used, or perhaps not deallocated because the logic looks for a byte count rather than a non NULL pointer.

 

An example report in the Memory tab:

 

zero-byte-allocation

 

Report unused memory instructionStep enable the detection of memory which is allocated, but later deallocated without actually having been used

 

This sometimes happens due to the logic of the function in which it occurs. Or maybe the memory was once required but the source code has changed and the person that changed the code has forgotten to remove the allocation and deallocation code.

 

An example of what you might see in the Memory tab:

 

unused-memory

 

Improving application performance: for each of the above cases, if this either of these conditions is detected it may be possible to modify the code to remove the allocation and deallocation and thus improve program performance by reducing the use of the heap manager and reducing memory consumption.

 

Report partially unused memory instructionStep enable the detection of memory allocated, but which is then later deallocated without all of it having been used

 

Report mismatched malloc / free / new / delete instructionStep enables detection of an inappropriate deallocation method compared to that used for allocation

 

 Allocated memory must be freed with the correctly paired deallocator:

 

new instructionStep delete

new [ ] instructionStep delete [ ]

malloc instructionStep free

 

On detection of mixed use, a report will appear in the Memory tab as below:
 

mismatched-new-free

 

Report VirtualAlloc() calls that implicitly waste memory instructionStep enables detection of VirtualAlloc() calls that implicitly waste memory because the allocation size requested is smaller than the minimum allocatable size for VirtualAlloc().
 
On detection of implicitly wasted memory the wasted memory will be reported in the Memory tab when you refresh the display.
 
There are two entries. The first entry (469 below) is for the VirtualAlloc() allocation. It also describes any implicitly leaked memory in the allocation - memory up to the next page boundary. The second entry (470 below) describes the free memory that follows the allocation (starts on the page boundary following the allocated memory).
 
VirtualAllocWastedMemory

 

 

noteFalse positives: note that Memory Validator detects unused blocks of memory by looking for an entire memory block with the uninitialized data signature. There may be rare occasions when the software has filled the entire memory block with the same signature. This will result in a false error report, but inspection of the source code should allow this to be validated.

 

 

Other conditions which are checked

 

In addition to the above conditions, the following conditions are also checked for:

 

Zero size allocation

Negative size allocation

Bad reallocation

Bad deallocation

Bad pointer to C heap

Bad start of C heap

Bad node in C heap

Damage in C++ heap

Damage in Release CRT heap

 

 

InitializeCriticalSection

 

Report multiple initialisation of Critical Sections instructionStep checks if CRITICAL_SECTION objects are initialized more than once

 

This error typically does not cause a problem in any program execution, but you may wish to find and remove the cause of these errors.

 

You may also find that some third party DLLs cause these errors. DLLs by nVidia often seem to generate these errors.

 

 

Functions

 

Report when abort is called instructionStep sets a signal handler will be called when raise(SIGABRT) is called, and if found reports a callstack showing where this happens

 

Report when a pure virtual function is called instructionStep sets a purecall handler that will be called if a pure virtual call is made, and if found reports a callstack showing where this happens

 

 

Reset All - Resets all global settings, not just those on the current page.

 

 

Reset - Resets the settings on the current page.