bool CmdHeaptrace::onServer(DebuggerProxy &proxy) { // globals std::vector<TypedValue *> roots; CArrRef arr = g_vmContext->m_globalVarEnv->getDefinedVariables(); arr->getChildren(roots); // static properties for (AllClasses ac; !ac.empty();) { Class *c = ac.popFront(); c->getChildren(roots); } // locals int numFrames = proxy.getRealStackDepth(); std::vector<Array> locs; for (int i = 0; i < numFrames; ++i) { locs.push_back(g_vmContext->getLocalDefinedVariables(i)); } for (CArrRef locArr : locs) { locArr->getChildren(roots); } Tracer<Accum>::traceAll( roots, [](TypedValue *node, Accum &accum) { accum.typesMap[(int64_t)node] = (int8_t)node->m_type; accum.sizeMap[(int64_t)node] = (int64_t)MemoryProfile::getSizeOfTV(node); }, [](TypedValue *parent, TypedValue *child, Accum &accum) { accum.adjacencyList[(int64_t)parent].push_back((int64_t)child); }, m_accum ); return proxy.sendToClient(this); }