dr_register_delete_event

Function dr_register_delete_event 

Source
pub unsafe extern "C" fn dr_register_delete_event(
    func: Option<unsafe extern "C" fn(drcontext: *mut c_void, tag: *mut c_void)>,
)
Expand description

Registers a callback function for the fragment deletion event. DR calls \p func whenever it removes a fragment from the code cache. Due to DR’s high-performance non-precise flushing, a fragment can be made inaccessible but not actually freed for some time. A new fragment can thus be created before the deletion event for the old fragment is raised. We recommended using a counter to ignore subsequent deletion events when using per-fragment data structures and duplicate fragments are seen.

\note drcontext may be NULL when thread-shared fragments are being deleted during process exit. For this reason, thread-private heap should not be used for data structures intended to be freed at thread-shared fragment deletion.