aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-11-21 23:29:56 -0800
committerEric Anholt <[email protected]>2013-11-22 16:36:27 -0800
commit09db4940eede4236b47e1328503a719719f5c981 (patch)
tree8344b1add3a683fc0a52eaf49a85efdec9504bca /src/glsl
parent5891f981452c1c5ed45b5a7e5fe54a9884ced2b6 (diff)
mesa: Remove the ralloc canary on release builds.
The canary is basically just to give a better debugging message when you ralloc_free() something that wasn't rallocated. Reduces maximum memory usage of apitrace replay of the dota2 demo by 60MB on my 64-bit system (so half that on a real 32-bit dota2 environment). Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ralloc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/glsl/ralloc.c b/src/glsl/ralloc.c
index e79dad764bb..36bc61fd075 100644
--- a/src/glsl/ralloc.c
+++ b/src/glsl/ralloc.c
@@ -53,8 +53,10 @@ _CRTIMP int _vscprintf(const char *format, va_list argptr);
struct ralloc_header
{
+#ifdef DEBUG
/* A canary value used to determine whether a pointer is ralloc'd. */
unsigned canary;
+#endif
struct ralloc_header *parent;
@@ -78,7 +80,9 @@ get_header(const void *ptr)
{
ralloc_header *info = (ralloc_header *) (((char *) ptr) -
sizeof(ralloc_header));
+#ifdef DEBUG
assert(info->canary == CANARY);
+#endif
return info;
}
@@ -117,7 +121,9 @@ ralloc_size(const void *ctx, size_t size)
add_child(parent, info);
+#ifdef DEBUG
info->canary = CANARY;
+#endif
return PTR_FROM_HEADER(info);
}