Remove useless (and broken) logging logic in memory context functions.
authorTom Lane <[email protected]>
Thu, 23 Apr 2020 19:27:37 +0000 (15:27 -0400)
committerTom Lane <[email protected]>
Thu, 23 Apr 2020 19:27:37 +0000 (15:27 -0400)
Nobody really uses this stuff, especially not since we created
valgrind-based infrastructure that does the same thing better.
It is thus unsurprising that the generation.c and slab.c versions
were actually broken.  Rather than fix 'em, let's just remove 'em.

Alexander Lakhin

Discussion: https://postgr.es/m/8936216c-3492-3f6e-634b-d638fddc5f91@gmail.com

src/backend/utils/mmgr/aset.c
src/backend/utils/mmgr/generation.c
src/backend/utils/mmgr/slab.c

index c0623f106d2b8e640de9d4ce28f1b77438213c1b..dd8d7a33a4fcaf113894fcf17f2814597905a60e 100644 (file)
@@ -50,9 +50,6 @@
 #include "utils/memdebug.h"
 #include "utils/memutils.h"
 
-/* Define this to detail debug alloc information */
-/* #define HAVE_ALLOCINFO */
-
 /*--------------------
  * Chunk freelist k holds chunks of size 1 << (k + ALLOC_MINBITS),
  * for k = 0 .. ALLOCSET_NUM_FREELISTS-1.
@@ -298,21 +295,6 @@ static const MemoryContextMethods AllocSetMethods = {
 #endif
 };
 
-/* ----------
- * Debug macros
- * ----------
- */
-#ifdef HAVE_ALLOCINFO
-#define AllocFreeInfo(_cxt, _chunk) \
-                       fprintf(stderr, "AllocFree: %s: %p, %zu\n", \
-                               (_cxt)->header.name, (_chunk), (_chunk)->size)
-#define AllocAllocInfo(_cxt, _chunk) \
-                       fprintf(stderr, "AllocAlloc: %s: %p, %zu\n", \
-                               (_cxt)->header.name, (_chunk), (_chunk)->size)
-#else
-#define AllocFreeInfo(_cxt, _chunk)
-#define AllocAllocInfo(_cxt, _chunk)
-#endif
 
 /* ----------
  * AllocSetFreeIndex -
@@ -796,8 +778,6 @@ AllocSetAlloc(MemoryContext context, Size size)
                        set->blocks = block;
                }
 
-               AllocAllocInfo(set, chunk);
-
                /* Ensure any padding bytes are marked NOACCESS. */
                VALGRIND_MAKE_MEM_NOACCESS((char *) AllocChunkGetPointer(chunk) + size,
                                                                   chunk_size - size);
@@ -835,8 +815,6 @@ AllocSetAlloc(MemoryContext context, Size size)
                randomize_mem((char *) AllocChunkGetPointer(chunk), size);
 #endif
 
-               AllocAllocInfo(set, chunk);
-
                /* Ensure any padding bytes are marked NOACCESS. */
                VALGRIND_MAKE_MEM_NOACCESS((char *) AllocChunkGetPointer(chunk) + size,
                                                                   chunk->size - size);
@@ -996,8 +974,6 @@ AllocSetAlloc(MemoryContext context, Size size)
        randomize_mem((char *) AllocChunkGetPointer(chunk), size);
 #endif
 
-       AllocAllocInfo(set, chunk);
-
        /* Ensure any padding bytes are marked NOACCESS. */
        VALGRIND_MAKE_MEM_NOACCESS((char *) AllocChunkGetPointer(chunk) + size,
                                                           chunk_size - size);
@@ -1021,8 +997,6 @@ AllocSetFree(MemoryContext context, void *pointer)
        /* Allow access to private part of chunk header. */
        VALGRIND_MAKE_MEM_DEFINED(chunk, ALLOCCHUNK_PRIVATE_LEN);
 
-       AllocFreeInfo(set, chunk);
-
 #ifdef MEMORY_CONTEXT_CHECKING
        /* Test for someone scribbling on unused space in chunk */
        if (chunk->requested_size < chunk->size)
index 56651d0693132dd15e3d95e8fbea93fb427ea5a2..af52616e575dfb02633fc1274355ef4f2c7b1650 100644 (file)
@@ -178,22 +178,6 @@ static const MemoryContextMethods GenerationMethods = {
 #endif
 };
 
-/* ----------
- * Debug macros
- * ----------
- */
-#ifdef HAVE_ALLOCINFO
-#define GenerationFreeInfo(_cxt, _chunk) \
-                       fprintf(stderr, "GenerationFree: %s: %p, %lu\n", \
-                               (_cxt)->name, (_chunk), (_chunk)->size)
-#define GenerationAllocInfo(_cxt, _chunk) \
-                       fprintf(stderr, "GenerationAlloc: %s: %p, %lu\n", \
-                               (_cxt)->name, (_chunk), (_chunk)->size)
-#else
-#define GenerationFreeInfo(_cxt, _chunk)
-#define GenerationAllocInfo(_cxt, _chunk)
-#endif
-
 
 /*
  * Public routines
@@ -383,8 +367,6 @@ GenerationAlloc(MemoryContext context, Size size)
                /* add the block to the list of allocated blocks */
                dlist_push_head(&set->blocks, &block->node);
 
-               GenerationAllocInfo(set, chunk);
-
                /* Ensure any padding bytes are marked NOACCESS. */
                VALGRIND_MAKE_MEM_NOACCESS((char *) GenerationChunkGetPointer(chunk) + size,
                                                                   chunk_size - size);
@@ -460,8 +442,6 @@ GenerationAlloc(MemoryContext context, Size size)
        randomize_mem((char *) GenerationChunkGetPointer(chunk), size);
 #endif
 
-       GenerationAllocInfo(set, chunk);
-
        /* Ensure any padding bytes are marked NOACCESS. */
        VALGRIND_MAKE_MEM_NOACCESS((char *) GenerationChunkGetPointer(chunk) + size,
                                                           chunk_size - size);
index c928476c479e34275ebde76952ac3fbf9d514157..e9e962d76747e9a9c60ee3d93ea44bbb61db55f5 100644 (file)
@@ -157,22 +157,6 @@ static const MemoryContextMethods SlabMethods = {
 #endif
 };
 
-/* ----------
- * Debug macros
- * ----------
- */
-#ifdef HAVE_ALLOCINFO
-#define SlabFreeInfo(_cxt, _chunk) \
-                       fprintf(stderr, "SlabFree: %s: %p, %zu\n", \
-                               (_cxt)->header.name, (_chunk), (_chunk)->header.size)
-#define SlabAllocInfo(_cxt, _chunk) \
-                       fprintf(stderr, "SlabAlloc: %s: %p, %zu\n", \
-                               (_cxt)->header.name, (_chunk), (_chunk)->header.size)
-#else
-#define SlabFreeInfo(_cxt, _chunk)
-#define SlabAllocInfo(_cxt, _chunk)
-#endif
-
 
 /*
  * SlabContextCreate
@@ -499,8 +483,6 @@ SlabAlloc(MemoryContext context, Size size)
        randomize_mem((char *) SlabChunkGetPointer(chunk), size);
 #endif
 
-       SlabAllocInfo(slab, chunk);
-
        Assert(slab->nblocks * slab->blockSize == context->mem_allocated);
 
        return SlabChunkGetPointer(chunk);
@@ -518,8 +500,6 @@ SlabFree(MemoryContext context, void *pointer)
        SlabChunk  *chunk = SlabPointerGetChunk(pointer);
        SlabBlock  *block = chunk->block;
 
-       SlabFreeInfo(slab, chunk);
-
 #ifdef MEMORY_CONTEXT_CHECKING
        /* Test for someone scribbling on unused space in chunk */
        if (slab->chunkSize < (slab->fullChunkSize - sizeof(SlabChunk)))