aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/memory.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2017-04-30 04:26:43 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2017-04-30 04:26:43 +0200
commit8d313963e7680d1dadd7fd6a3c271c2792ffe509 (patch)
treed60539c77f3cbe509575e06b93eec38dea955ec6 /src/memory.h
parent1d689ebfec51613fcb1fe286294c85dcbb9d8574 (diff)
downloadsciteco-8d313963e7680d1dadd7fd6a3c271c2792ffe509.tar.gz
define non-sized deallocator and memory counting debugging
* it turned out to be possible to provoke memory_usage overflows or underruns, resulting in unrecoverable states * a possible reason can be that at least with G++ 5.4.0, the compiler would sometimes call the (default) non-sized delete followed by our custom sized delete/deallocator. * This was true even after compiling Scintilla with -fsized-deallocation. * therefore we provide an empty non-sized delete now. * memory_usage counting can now be debugged by uncommenting DEBUG_MAGIC in memory.cpp. This uses a magic value to detect instrumented allocations being mixed with non-instrumented allocations. * simplified the global sized-deallocation functions (they are identical to the Object-class allocators).
Diffstat (limited to 'src/memory.h')
-rw-r--r--src/memory.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/memory.h b/src/memory.h
index 903fd16..693a208 100644
--- a/src/memory.h
+++ b/src/memory.h
@@ -40,9 +40,11 @@ namespace SciTECO {
* scalars (e.g. new char[5]).
*
* C++14 (supported by GCC >= 5) has global sized delete
- * replacements which would be effective in the entire application
- * but we're still using the base-class approach since
- * we must support the older compilers anyway.
+ * replacements which would be effective in the entire application.
+ * We're using them too if support is detected and there is
+ * also a fallback using malloc_usable_size().
+ * Another fallback with a size field would be possible
+ * but is probably not worth the trouble.
*/
class Object {
public: