Core: remove WITH_CXX_GUARDEDALLOC option

This implements the proposal from #124512. For that it contains the following
changes:
* Remove the global override of `new`/`delete` when `WITH_CXX_GUARDEDALLOC` was
  enabled.
* Always use `MEM_CXX_CLASS_ALLOC_FUNCS` where it is currently used. This used
  to be guarded by `WITH_CXX_GUARDEDALLOC` in some but not all cases. This means
  that a few classes which didn't use our guarded allocator by default before,
  are now using it.

Pull Request: https://projects.blender.org/blender/blender/pulls/130181
This commit is contained in:
Jacques Lucke
2024-11-13 13:39:49 +01:00
parent 702bdde96d
commit 64a9260921
139 changed files with 88 additions and 712 deletions

View File

@@ -5,6 +5,7 @@
set(INC
.
intern
../guardedalloc
)
set(INC_SYS

View File

@@ -5,9 +5,7 @@
#ifndef __DUALCON_H__
#define __DUALCON_H__
#ifdef WITH_CXX_GUARDEDALLOC
# include "MEM_guardedalloc.h"
#endif
#include "MEM_guardedalloc.h"
#ifdef __cplusplus
extern "C" {

View File

@@ -33,9 +33,7 @@ class VirtualMemoryAllocator {
virtual int getAll() = 0;
virtual int getBytes() = 0;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:VirtualMemoryAllocator")
#endif
};
/**
@@ -194,9 +192,7 @@ template<int N> class MemoryAllocator : public VirtualMemoryAllocator {
return N;
};
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:MemoryAllocator")
#endif
};
#endif /* __MEMORYALLOCATOR_H__ */

View File

@@ -7,9 +7,7 @@
#include "GeoCommon.h"
#ifdef WITH_CXX_GUARDEDALLOC
# include "MEM_guardedalloc.h"
#endif
#include "MEM_guardedalloc.h"
/*
* Virtual class for input file readers
@@ -44,9 +42,7 @@ class ModelReader {
virtual void printInfo() = 0;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:ModelReader")
#endif
};
#endif /* __MODELREADER_H__ */

View File

@@ -2,9 +2,7 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#ifdef WITH_CXX_GUARDEDALLOC
# include "MEM_guardedalloc.h"
#endif
#include "MEM_guardedalloc.h"
#include "Projections.h"
#include <math.h>

View File

@@ -106,9 +106,7 @@ class CubeTriangleIsect {
float getIntersectionPrimary(int edgeInd) const;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:CubeTriangleIsect")
#endif
};
#endif /* __PROJECTIONS_H__ */

View File

@@ -75,9 +75,7 @@ class GridQueue {
return 1;
}
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:GridQueue")
#endif
};
#endif /* __QUEUE_H__ */

View File

@@ -24,9 +24,7 @@ class Cubes {
}
}
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:Cubes")
#endif
};
#endif /* __CUBES_H__ */

View File

@@ -143,9 +143,7 @@ class DualConInputReader : public ModelReader {
return sizeof(DualConInputReader);
}
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:DualConInputReader")
#endif
};
void *dualcon(const DualConInput *input_mesh,

View File

@@ -2,9 +2,7 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#ifdef WITH_CXX_GUARDEDALLOC
# include "MEM_guardedalloc.h"
#endif
#include "MEM_guardedalloc.h"
#include "octree.h"
#include <Eigen/Dense>

View File

@@ -1390,9 +1390,7 @@ class Octree {
return npar;
}
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("DUALCON:Octree")
#endif
};
#endif /* __OCTREE_H__ */