jvmtiError tagHeap()

in src/sizes/retained_size_action.h [84:104]


    jvmtiError tagHeap() {
        jvmtiError err = this->FollowReferences(0, nullptr, nullptr, getTagsWithNewInfo, nullptr, "find objects with new info");
        if (err != JVMTI_ERROR_NONE) return err;
        if (this->shouldStopExecution()) return MEMORY_AGENT_INTERRUPTED_ERROR;

        std::vector<jobject> objects;
        logger::debug("collect objects with new info");
        err = getObjectsByTags(this->jvmti, std::vector<jlong>{pointerToTag(&Tag::TagWithNewInfo)}, objects);
        if (err != JVMTI_ERROR_NONE) return err;
        if (this->shouldStopExecution()) return MEMORY_AGENT_INTERRUPTED_ERROR;

        err = this->IterateThroughHeap(JVMTI_HEAP_FILTER_UNTAGGED, nullptr, retagStartObjects, nullptr, "retag start objects");
        if (err != JVMTI_ERROR_NONE) return err;
        if (this->shouldStopExecution()) return MEMORY_AGENT_INTERRUPTED_ERROR;

        err = this->FollowReferences(0, nullptr, nullptr, visitReference, nullptr, "tag heap");
        if (err != JVMTI_ERROR_NONE) return err;
        if (this->shouldStopExecution()) return MEMORY_AGENT_INTERRUPTED_ERROR;

        return walkHeapFromObjects(this->jvmti, objects, *dynamic_cast<CancellationChecker *>(this));
    }