Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit46fb9c2

Browse files
committed
Here is the patch with memory leak checker. This checker allow detect
in-chunk leaks, overwrite-next-chunk leaks and overwrite block-freeptr leaks.A in-chunk leak --- if something overwrite space after wanted (via palloc()size, but it is still inside chunk. For example x = palloc(12); /* create 16b chunk */ memset(x, '#', 13);this leak is in the current source total invisible, because chunk is 16b andleak is in the "align space". For this feature I add data_size to StandardChunk, and all memory which gofrom AllocSetAlloc() is marked as 0x7F. The MemoryContextCheck() is compiled '#ifdef USE_ASSERT_CHECKING'.I add this checking to 'tcop/postgres.c' and is active after each backendquery, but it is probably not sufficient, because some MemoryContext existonly during memory processing --- will good if someone who known whereit is needful (Tom:-) add it for others contexts; A problem in the current source is that we have still some malloc()allocation that is not needful and this allocation is total invisible forall context routines. For example Dllist in backend (pretty dirty it is incatcache where values in Dllist are palloc-ed, but list is malloc-ed).--- and BTW. this Dllist design stand in the way for query cache :-) Tom, if you agree I start replace some mallocs. BTW. --- Tom, have you idea for across transaction presistent allocation for SQL functions? (like regex - now it is via malloc) I almost forget. I add one if() to AllocSetAlloc(), for 'size' that aregreater than ALLOC_BIGCHUNK_LIMIT is not needful check AllocSetFreeIndex(),because 'fidx' is always 'ALLOCSET_NUM_FREELISTS - 1'. It a little brisk upallocation for very large chunks. Right? Karel
1 parent0d32cdc commit46fb9c2

File tree

6 files changed

+284
-35
lines changed

6 files changed

+284
-35
lines changed

‎src/backend/tcop/postgres.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.167 2000/07/08 03:04:15 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.168 2000/07/11 14:30:27 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1415,7 +1415,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
14151415
if (!IsUnderPostmaster)
14161416
{
14171417
puts("\nPOSTGRES backend interactive interface ");
1418-
puts("$Revision: 1.167 $ $Date: 2000/07/08 03:04:15 $\n");
1418+
puts("$Revision: 1.168 $ $Date: 2000/07/11 14:30:27 $\n");
14191419
}
14201420

14211421
/*
@@ -1653,6 +1653,13 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
16531653
if (IsUnderPostmaster)
16541654
NullCommand(Remote);
16551655
}
1656+
1657+
#ifdefMEMORY_CONTEXT_CHECKING
1658+
/*
1659+
* Check all memory after each backend loop
1660+
*/
1661+
MemoryContextCheck(TopMemoryContext);
1662+
#endif
16561663
}/* infinite for-loop */
16571664

16581665
proc_exit(0);/* shouldn't get here... */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp