projects
/
pgpool2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
13d6515
)
Import some of memory manager debug facilities from PostgreSQL.
author
Tatsuo Ishii
<ishii@sraoss.co.jp>
Thu, 8 Aug 2019 02:02:50 +0000
(11:02 +0900)
committer
Tatsuo Ishii
<ishii@sraoss.co.jp>
Thu, 8 Aug 2019 02:16:37 +0000
(11:16 +0900)
Now we can use CLOBBER_FREED_MEMORY, which is useful to detect
accesses to already pfreed memory.
src/include/utils/memdebug.h
patch
|
blob
|
blame
|
history
diff --git
a/src/include/utils/memdebug.h
b/src/include/utils/memdebug.h
index 0b955693e612aeda4f569e4b1e0719667b9fe27c..f7b08bbf1855cbfd259ba823c1e8ad2c26796530 100644
(file)
--- a/
src/include/utils/memdebug.h
+++ b/
src/include/utils/memdebug.h
@@
-31,4
+31,17
@@
#define VALGRIND_MEMPOOL_CHANGE(context, optr, nptr, size) do {} while (0)
#endif
-#endif /* MEMDEBUG_H */
+#ifdef CLOBBER_FREED_MEMORY
+
+/* Wipe freed memory for debugging purposes */
+static inline void
+wipe_mem(void *ptr, size_t size)
+{
+ VALGRIND_MAKE_MEM_UNDEFINED(ptr, size);
+ memset(ptr, 0x7F, size);
+ VALGRIND_MAKE_MEM_NOACCESS(ptr, size);
+}
+
+#endif /* CLOBBER_FREED_MEMORY */
+
+#endif /* MEMDEBUG_H */
\ No newline at end of file