mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
more guardedalloc use in C++, also make compositorMutex a static var, was allocated and never freed.
This commit is contained in:
parent
cc0784c1b9
commit
3c8a4c458b
18 changed files with 93 additions and 33 deletions
|
|
@ -28,20 +28,36 @@
|
|||
#include <new>
|
||||
#include "../MEM_guardedalloc.h"
|
||||
|
||||
void* operator new (size_t size)
|
||||
{
|
||||
return MEM_mallocN(size, "C++/anonymous");
|
||||
}
|
||||
|
||||
/* not default but can be used when needing to set a string */
|
||||
void* operator new (size_t size, const char *str)
|
||||
void *operator new(size_t size, const char *str)
|
||||
{
|
||||
return MEM_mallocN(size, str);
|
||||
}
|
||||
void *operator new[](size_t size, const char *str)
|
||||
{
|
||||
return MEM_mallocN(size, str);
|
||||
}
|
||||
|
||||
void operator delete (void *p)
|
||||
|
||||
void *operator new(size_t size)
|
||||
{
|
||||
return MEM_mallocN(size, "C++/anonymous");
|
||||
}
|
||||
void *operator new[](size_t size)
|
||||
{
|
||||
return MEM_mallocN(size, "C++/anonymous[]");
|
||||
}
|
||||
|
||||
|
||||
void operator delete(void *p)
|
||||
{
|
||||
/* delete NULL is valid in c++ */
|
||||
if(p)
|
||||
if (p)
|
||||
MEM_freeN(p);
|
||||
}
|
||||
void operator delete[](void *p)
|
||||
{
|
||||
/* delete NULL is valid in c++ */
|
||||
if (p)
|
||||
MEM_freeN(p);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue