Cross-thread allocations are when memory is allocated in one thread, and is deallocated or reallocated in another thread.
Memory Validator connects these events, as well as resource handle allocations and releases.
Cross-thread allocations are perfectly valid, for example, a main thread may place data objects onto a queue in a worker thread that deletes them after processing.
However, the practice can also result in unintentional behaviour as well. For example, after a process that started off single threaded has been made multi-threaded.
Often these errors occur when memory is unexpectedly deallocated in a diffferent thread.
Using the cross-thread allocations dialog below, you can find these cross-thread allocations and deallocations.
By inspecting them you can verify expected behaviour, and look out for unexpected behaviour.
To show the cross-thread allocations dialog, choose the menu option below:
Or use the following icon on the Query Toolbar.
There is just the one button - to start the search
•Find start the search and display results in the list
Results include cross-thread reallocations and deallocations.
For larger datasets, the search can take some time.
Note that results displayed in green indicate that some (possibly all) allocations made on this callstack have been successfully deallocated.
Memory Validator has an example program with which to safely explore all the features available.
The following sequence will allocate memory in one thread and free it in another.
Searching for cross-thread allocations