Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ee88ef5

Browse files
committed
Remove useless (and broken) logging logic in memory context functions.
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
1 parent 5b0aa11 commit ee88ef5

File tree

3 files changed

+0
-66
lines changed

3 files changed

+0
-66
lines changed

src/backend/utils/mmgr/aset.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@
5050
#include "utils/memdebug.h"
5151
#include "utils/memutils.h"
5252

53-
/* Define this to detail debug alloc information */
54-
/* #define HAVE_ALLOCINFO */
55-
5653
/*--------------------
5754
* Chunk freelist k holds chunks of size 1 << (k + ALLOC_MINBITS),
5855
* for k = 0 .. ALLOCSET_NUM_FREELISTS-1.
@@ -298,21 +295,6 @@ static const MemoryContextMethods AllocSetMethods = {
298295
#endif
299296
};
300297

301-
/* ----------
302-
* Debug macros
303-
* ----------
304-
*/
305-
#ifdef HAVE_ALLOCINFO
306-
#define AllocFreeInfo(_cxt, _chunk) \
307-
fprintf(stderr, "AllocFree: %s: %p, %zu\n", \
308-
(_cxt)->header.name, (_chunk), (_chunk)->size)
309-
#define AllocAllocInfo(_cxt, _chunk) \
310-
fprintf(stderr, "AllocAlloc: %s: %p, %zu\n", \
311-
(_cxt)->header.name, (_chunk), (_chunk)->size)
312-
#else
313-
#define AllocFreeInfo(_cxt, _chunk)
314-
#define AllocAllocInfo(_cxt, _chunk)
315-
#endif
316298

317299
/* ----------
318300
* AllocSetFreeIndex -
@@ -796,8 +778,6 @@ AllocSetAlloc(MemoryContext context, Size size)
796778
set->blocks = block;
797779
}
798780

799-
AllocAllocInfo(set, chunk);
800-
801781
/* Ensure any padding bytes are marked NOACCESS. */
802782
VALGRIND_MAKE_MEM_NOACCESS((char *) AllocChunkGetPointer(chunk) + size,
803783
chunk_size - size);
@@ -835,8 +815,6 @@ AllocSetAlloc(MemoryContext context, Size size)
835815
randomize_mem((char *) AllocChunkGetPointer(chunk), size);
836816
#endif
837817

838-
AllocAllocInfo(set, chunk);
839-
840818
/* Ensure any padding bytes are marked NOACCESS. */
841819
VALGRIND_MAKE_MEM_NOACCESS((char *) AllocChunkGetPointer(chunk) + size,
842820
chunk->size - size);
@@ -996,8 +974,6 @@ AllocSetAlloc(MemoryContext context, Size size)
996974
randomize_mem((char *) AllocChunkGetPointer(chunk), size);
997975
#endif
998976

999-
AllocAllocInfo(set, chunk);
1000-
1001977
/* Ensure any padding bytes are marked NOACCESS. */
1002978
VALGRIND_MAKE_MEM_NOACCESS((char *) AllocChunkGetPointer(chunk) + size,
1003979
chunk_size - size);
@@ -1021,8 +997,6 @@ AllocSetFree(MemoryContext context, void *pointer)
1021997
/* Allow access to private part of chunk header. */
1022998
VALGRIND_MAKE_MEM_DEFINED(chunk, ALLOCCHUNK_PRIVATE_LEN);
1023999

1024-
AllocFreeInfo(set, chunk);
1025-
10261000
#ifdef MEMORY_CONTEXT_CHECKING
10271001
/* Test for someone scribbling on unused space in chunk */
10281002
if (chunk->requested_size < chunk->size)

src/backend/utils/mmgr/generation.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -178,22 +178,6 @@ static const MemoryContextMethods GenerationMethods = {
178178
#endif
179179
};
180180

181-
/* ----------
182-
* Debug macros
183-
* ----------
184-
*/
185-
#ifdef HAVE_ALLOCINFO
186-
#define GenerationFreeInfo(_cxt, _chunk) \
187-
fprintf(stderr, "GenerationFree: %s: %p, %lu\n", \
188-
(_cxt)->name, (_chunk), (_chunk)->size)
189-
#define GenerationAllocInfo(_cxt, _chunk) \
190-
fprintf(stderr, "GenerationAlloc: %s: %p, %lu\n", \
191-
(_cxt)->name, (_chunk), (_chunk)->size)
192-
#else
193-
#define GenerationFreeInfo(_cxt, _chunk)
194-
#define GenerationAllocInfo(_cxt, _chunk)
195-
#endif
196-
197181

198182
/*
199183
* Public routines
@@ -383,8 +367,6 @@ GenerationAlloc(MemoryContext context, Size size)
383367
/* add the block to the list of allocated blocks */
384368
dlist_push_head(&set->blocks, &block->node);
385369

386-
GenerationAllocInfo(set, chunk);
387-
388370
/* Ensure any padding bytes are marked NOACCESS. */
389371
VALGRIND_MAKE_MEM_NOACCESS((char *) GenerationChunkGetPointer(chunk) + size,
390372
chunk_size - size);
@@ -460,8 +442,6 @@ GenerationAlloc(MemoryContext context, Size size)
460442
randomize_mem((char *) GenerationChunkGetPointer(chunk), size);
461443
#endif
462444

463-
GenerationAllocInfo(set, chunk);
464-
465445
/* Ensure any padding bytes are marked NOACCESS. */
466446
VALGRIND_MAKE_MEM_NOACCESS((char *) GenerationChunkGetPointer(chunk) + size,
467447
chunk_size - size);

src/backend/utils/mmgr/slab.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -157,22 +157,6 @@ static const MemoryContextMethods SlabMethods = {
157157
#endif
158158
};
159159

160-
/* ----------
161-
* Debug macros
162-
* ----------
163-
*/
164-
#ifdef HAVE_ALLOCINFO
165-
#define SlabFreeInfo(_cxt, _chunk) \
166-
fprintf(stderr, "SlabFree: %s: %p, %zu\n", \
167-
(_cxt)->header.name, (_chunk), (_chunk)->header.size)
168-
#define SlabAllocInfo(_cxt, _chunk) \
169-
fprintf(stderr, "SlabAlloc: %s: %p, %zu\n", \
170-
(_cxt)->header.name, (_chunk), (_chunk)->header.size)
171-
#else
172-
#define SlabFreeInfo(_cxt, _chunk)
173-
#define SlabAllocInfo(_cxt, _chunk)
174-
#endif
175-
176160

177161
/*
178162
* SlabContextCreate
@@ -499,8 +483,6 @@ SlabAlloc(MemoryContext context, Size size)
499483
randomize_mem((char *) SlabChunkGetPointer(chunk), size);
500484
#endif
501485

502-
SlabAllocInfo(slab, chunk);
503-
504486
Assert(slab->nblocks * slab->blockSize == context->mem_allocated);
505487

506488
return SlabChunkGetPointer(chunk);
@@ -518,8 +500,6 @@ SlabFree(MemoryContext context, void *pointer)
518500
SlabChunk *chunk = SlabPointerGetChunk(pointer);
519501
SlabBlock *block = chunk->block;
520502

521-
SlabFreeInfo(slab, chunk);
522-
523503
#ifdef MEMORY_CONTEXT_CHECKING
524504
/* Test for someone scribbling on unused space in chunk */
525505
if (slab->chunkSize < (slab->fullChunkSize - sizeof(SlabChunk)))

0 commit comments

Comments
 (0)