Add BCC support for rs_object_slots metadata.
This is added to support proper cleanup of RS resources. We were leaking some
global resources because there was no way to tell which slots to clear.
Change-Id: I3e01ff4f7105444b7610d514f10dd56cb1b359b8
b: 3381615
diff --git a/lib/bcc/ScriptCached.cpp b/lib/bcc/ScriptCached.cpp
index b4cf99d..1003163 100644
--- a/lib/bcc/ScriptCached.cpp
+++ b/lib/bcc/ScriptCached.cpp
@@ -37,6 +37,7 @@
if (mpStringPoolRaw) { free(mpStringPoolRaw); }
if (mpExportVars) { free(mpExportVars); }
if (mpExportFuncs) { free(mpExportFuncs); }
+ if (mpObjectSlotList) { free(mpObjectSlotList); }
}
void ScriptCached::getExportVarList(size_t varListSize, void **varList) {
@@ -89,6 +90,21 @@
}
+void ScriptCached::getObjectSlotList(size_t objectSlotListSize,
+ uint32_t *objectSlotList) {
+ if (objectSlotList) {
+ size_t objectSlotCount = getObjectSlotCount();
+
+ if (objectSlotCount > objectSlotListSize) {
+ objectSlotCount = objectSlotListSize;
+ }
+
+ memcpy(objectSlotList, mpObjectSlotList->object_slot_list,
+ sizeof(uint32_t) * objectSlotCount);
+ }
+}
+
+
void *ScriptCached::lookup(const char *name) {
FuncTable::const_iterator I = mFunctions.find(name);
return (I == mFunctions.end()) ? NULL : I->second.first;