summaryrefslogtreecommitdiffstats
path: root/document/src/tests/heapdebugger.h
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /document/src/tests/heapdebugger.h
Publish
Diffstat (limited to 'document/src/tests/heapdebugger.h')
-rw-r--r--document/src/tests/heapdebugger.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/document/src/tests/heapdebugger.h b/document/src/tests/heapdebugger.h
new file mode 100644
index 00000000000..deb862fbec3
--- /dev/null
+++ b/document/src/tests/heapdebugger.h
@@ -0,0 +1,68 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+/**
+ * @file heapdebugger.h
+ *
+ * @author Ove Martin Malm
+ * @date Creation date: 2000-08-09
+ * @version $Id$
+ * @file mcheckhooks.h
+ *
+ * Copyright (c) : 1997-2000 Fast Search & Transfer ASA
+ * ALL RIGHTS RESERVED
+ */
+
+#pragma once
+#include <cstddef>
+
+
+/**
+ * This function is used for counting memory usage. Must be called before any block is allocated
+ * (pt. linux only)
+ * Parameter controls operation
+ */
+extern void enableHeapUsageMonitor(int param = 0);
+
+
+/**
+ * This function return the current memory used.
+ * @return Net number of bytes allocated on the heap
+ */
+extern size_t getHeapUsage(void);
+
+/**
+ * This enables heap debugging. Must be called before any block is allocated
+ * Parameter controls operation
+ * (pt. linux only)
+ */
+extern void enableHeapCorruptCheck(int param = 0);
+
+#define HEAPCHECKMODE_REMOVE -1 // Deinstall
+#define HEAPCHECKMODE_NORMAL 0 // Normal
+#define HEAPCHECKMODE_EXTENSIVE 1 // All allocated blocks checked on all ops..
+#define HEAPCHECKMODE_DISABLED 2 // No checking (but extra bytes allocated)
+
+
+
+/**
+ * Run a heap check now. Will lock the heap and run through a full check. Will crash if it fails...
+ */
+extern void checkHeapNow(void);
+
+
+/**
+ * And this enables linux mcheck function with an approprate callback function. (absolutely linux only)
+ * see man mcheck
+ */
+extern void enableMCheck(void);
+
+
+
+
+
+
+
+
+
+
+
+