Download pgsql/include/server/utils/memdebug.h from codekingpro/portable-devtools: direct link, hf CLI and curl.
- Browser
- Download file 2.2 kB
-
https://huggingface.co/datasets/codekingpro/portable-devtools/resolve/df58e70f9edde36aaca2d2aacc2440dd6c2f807d/pgsql/include/server/utils/memdebug.h
- Command line
-
hf download hf://datasets/codekingpro/portable-devtools@df58e70f9edde36aaca2d2aacc2440dd6c2f807d/pgsql/include/server/utils/memdebug.h
-
curl -L -o memdebug.h https://huggingface.co/datasets/codekingpro/portable-devtools/resolve/df58e70f9edde36aaca2d2aacc2440dd6c2f807d/pgsql/include/server/utils/memdebug.h
2.2 kB
| /*------------------------------------------------------------------------- | |
| * | |
| * memdebug.h | |
| * Memory debugging support. | |
| * | |
| * Currently, this file either wraps <valgrind/memcheck.h> or substitutes | |
| * empty definitions for Valgrind client request macros we use. | |
| * | |
| * | |
| * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group | |
| * Portions Copyright (c) 1994, Regents of the University of California | |
| * | |
| * src/include/utils/memdebug.h | |
| * | |
| *------------------------------------------------------------------------- | |
| */ | |
| /* 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); | |
| } | |
| static inline void | |
| set_sentinel(void *base, Size offset) | |
| { | |
| char *ptr = (char *) base + offset; | |
| VALGRIND_MAKE_MEM_UNDEFINED(ptr, 1); | |
| *ptr = 0x7E; | |
| VALGRIND_MAKE_MEM_NOACCESS(ptr, 1); | |
| } | |
| static inline bool | |
| sentinel_ok(const void *base, Size offset) | |
| { | |
| const char *ptr = (const char *) base + offset; | |
| bool ret; | |
| VALGRIND_MAKE_MEM_DEFINED(ptr, 1); | |
| ret = *ptr == 0x7E; | |
| VALGRIND_MAKE_MEM_NOACCESS(ptr, 1); | |
| return ret; | |
| } | |
| void randomize_mem(char *ptr, size_t size); | |