summaryrefslogtreecommitdiffstats
path: root/libs/rs
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2009-11-02 14:25:10 -0800
committerJason Sams <rjsams@android.com>2009-11-02 14:25:10 -0800
commitb7a6c4340a35b7cc4ceeeccf6cc01ed82c99a8ba (patch)
tree1c359a6e0e15c5843c7835b48c2ac6513aa4f1c4 /libs/rs
parentee98c24020c1634b02cde6d333968f04a0de941f (diff)
downloadframeworks_base-b7a6c4340a35b7cc4ceeeccf6cc01ed82c99a8ba.zip
frameworks_base-b7a6c4340a35b7cc4ceeeccf6cc01ed82c99a8ba.tar.gz
frameworks_base-b7a6c4340a35b7cc4ceeeccf6cc01ed82c99a8ba.tar.bz2
Fix some leaks. This fixes the major malloc memory leak in allApps. Still tracking some much more minor issues.
Diffstat (limited to 'libs/rs')
-rw-r--r--libs/rs/rsAllocation.cpp2
-rw-r--r--libs/rs/rsContext.cpp3
-rw-r--r--libs/rs/rsObjectBase.cpp1
-rw-r--r--libs/rs/rsSimpleMesh.cpp2
-rw-r--r--libs/rs/rsType.cpp1
5 files changed, 9 insertions, 0 deletions
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(Context *rsc, const Type *type) : ObjectBase(rsc)
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 @@ void * Context::threadProc(void *vrsc)
rsc->deinitEGL();
pthread_mutex_unlock(&gInitMutex);
+ rsc->mObjDestroy.mNeedToEmpty = true;
rsc->objDestroyOOBRun();
LOGV("RS Thread exited");
return NULL;
@@ -421,6 +422,7 @@ Context::~Context()
mIO.shutdown();
int status = pthread_join(mThreadId, &res);
+ mObjDestroy.mNeedToEmpty = true;
objDestroyOOBRun();
// Global structure cleanup.
@@ -431,6 +433,7 @@ Context::~Context()
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 @@ ObjectBase::~ObjectBase()
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()
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()
TypeState::~TypeState()
{
+ delete[] mLODs;
}
size_t Type::getOffsetForFace(uint32_t face) const