projects
/
pgpool2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d2b3690
)
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:07:31 +0000
(11:07 +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 d258935ffe5b8b67dc5caf5be1a5b69f2b5a18bf..f28341d27d0fc868afe156af43f032f9ae3f8a48 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
+#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 */