jvmtiError MemoryAgentAction::IterateThroughHeap()

in src/memory_agent_action.hpp [88:102]


jvmtiError MemoryAgentAction<RESULT_TYPE, ARGS_TYPES...>::IterateThroughHeap(jint heapFilter, jclass klass, jvmtiHeapIterationCallback callback,
                                                                             void *userData, const char *debugMessage) const {
    if (shouldStopExecution()) return MEMORY_AGENT_INTERRUPTED_ERROR;

    if (debugMessage) {
        logger::debug(debugMessage);
    }

    jvmtiHeapCallbacks cb;
    std::memset(&cb, 0, sizeof(jvmtiHeapCallbacks));
    cb.heap_iteration_callback = iterateThroughHeapCallbackWrapper;

    CallbackWrapperData wrapperData(reinterpret_cast<void *>(callback), userData, dynamic_cast<const CancellationChecker *>(this));
    return jvmti->IterateThroughHeap(heapFilter, klass, &cb, &wrapperData);
}