Fix some leaks. This fixes the major malloc memory leak in allApps. Still tracking some much more minor issues.
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index b7d1297..2cbfe17 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -52,6 +52,8 @@
Allocation::~Allocation()
{
+ free(mPtr);
+ mPtr = NULL;
}
void Allocation::setCpuWritable(bool)
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index eb388af..961ec0b 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -350,6 +350,7 @@
rsc->deinitEGL();
pthread_mutex_unlock(&gInitMutex);
+ rsc->mObjDestroy.mNeedToEmpty = true;
rsc->objDestroyOOBRun();
LOGV("RS Thread exited");
return NULL;
@@ -421,6 +422,7 @@
mIO.shutdown();
int status = pthread_join(mThreadId, &res);
+ mObjDestroy.mNeedToEmpty = true;
objDestroyOOBRun();
// Global structure cleanup.
@@ -431,6 +433,7 @@
if (!gThreadTLSKeyCount) {
pthread_key_delete(gThreadTLSKey);
}
+ mDev = NULL;
}
pthread_mutex_unlock(&gInitMutex);
diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp
index 0008ea4..1b442ba 100644
--- a/libs/rs/rsObjectBase.cpp
+++ b/libs/rs/rsObjectBase.cpp
@@ -39,6 +39,7 @@
rsAssert(!mUserRefCount);
rsAssert(!mSysRefCount);
remove();
+ delete[] mName;
}
void ObjectBase::dumpLOGV(const char *op) const
diff --git a/libs/rs/rsSimpleMesh.cpp b/libs/rs/rsSimpleMesh.cpp
index b082fd7..434a35f 100644
--- a/libs/rs/rsSimpleMesh.cpp
+++ b/libs/rs/rsSimpleMesh.cpp
@@ -99,6 +99,8 @@
SimpleMeshContext::~SimpleMeshContext()
{
+ delete[] mVertexTypes;
+ delete[] mVertexBuffers;
}
diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp
index ddaa2f0..0eb4111 100644
--- a/libs/rs/rsType.cpp
+++ b/libs/rs/rsType.cpp
@@ -57,6 +57,7 @@
TypeState::~TypeState()
{
+ delete[] mLODs;
}
size_t Type::getOffsetForFace(uint32_t face) const