mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 16:50:10 +01:00
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 <kenneth@whitecape.org>
This commit is contained in:
parent
5891f98145
commit
09db4940ee
1 changed files with 6 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue