aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrMemoryPool.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-03-28 16:51:02 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-28 22:51:34 +0000
commita5002c384d97de24c61c5486fa0f84ab01179147 (patch)
tree8e5505f870e3444fcea93ad0b809a511d18f55b8 /src/gpu/GrMemoryPool.h
parent90b49b5f847c5cb92c902cc31d7fb87d18baa9fa (diff)
Add debug helper for finding leaks in GrMemoryPool.h
Change-Id: I1d11769f9e99606af5e7752b3a6d055a5bf6a48d Reviewed-on: https://skia-review.googlesource.com/10289 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrMemoryPool.h')
-rw-r--r--src/gpu/GrMemoryPool.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gpu/GrMemoryPool.h b/src/gpu/GrMemoryPool.h
index e483aab6f2..26a763430f 100644
--- a/src/gpu/GrMemoryPool.h
+++ b/src/gpu/GrMemoryPool.h
@@ -9,6 +9,9 @@
#define GrMemoryPool_DEFINED
#include "GrTypes.h"
+#ifdef SK_DEBUG
+#include "SkTHash.h"
+#endif
/**
* Allocates memory in blocks and parcels out space in the blocks for allocation
@@ -94,6 +97,7 @@ private:
struct AllocHeader {
#ifdef SK_DEBUG
uint32_t fSentinal; ///< known value to check for memory stomping (e.g., (CD)*)
+ int32_t fID; ///< ID that can be used to track down leaks by clients.
#endif
BlockHeader* fHeader; ///< pointer back to the block header in which an alloc resides
};
@@ -105,6 +109,7 @@ private:
#ifdef SK_DEBUG
int fAllocationCnt;
int fAllocBlockCnt;
+ SkTHashSet<int32_t> fAllocatedIDs;
#endif
protected: