Re: 8.4devel out of memory
От | Tom Lane |
---|---|
Тема | Re: 8.4devel out of memory |
Дата | |
Msg-id | 12081.1223592933@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | 8.4devel out of memory ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>) |
Ответы |
Re: 8.4devel out of memory
|
Список | pgsql-hackers |
Hah, got it. The reason the leak only manifests on 32-bit is that it only manifests if int8 is a pass-by-reference datatype. The new API for amgetbitmap causes a query-lifespan leak of one palloc(sizeof(int8)) per bitmap index scan. The distinguishing feature of your query seems to be just that it does enough repeated bitmapscans to notice ... The attached patch cures the leak for me, but I find it a tad ugly. I'm tempted to think that it would be better if we changed the call signature for amgetbitmap so that it returned the count through an "int64 *" output parameter. Thoughts anyone? regards, tom lane Index: src/backend/access/index/indexam.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/access/index/indexam.c,v retrieving revision 1.110 diff -c -r1.110 indexam.c *** src/backend/access/index/indexam.c 11 Sep 2008 14:01:09 -0000 1.110 --- src/backend/access/index/indexam.c 9 Oct 2008 22:47:54 -0000 *************** *** 655,660 **** --- 655,661 ---- { FmgrInfo *procedure; int64 ntids; + Datum d; SCAN_CHECKS; GET_SCAN_PROCEDURE(amgetbitmap); *************** *** 665,673 **** /* * have the am's getbitmap proc do all the work. */ ! ntids = DatumGetInt64(FunctionCall2(procedure, ! PointerGetDatum(scan), ! PointerGetDatum(bitmap))); pgstat_count_index_tuples(scan->indexRelation,ntids); --- 666,680 ---- /* * have the am's getbitmap proc do all the work. */ ! d = FunctionCall2(procedure, ! PointerGetDatum(scan), ! PointerGetDatum(bitmap)); ! ! ntids = DatumGetInt64(d); ! ! #ifndef USE_FLOAT8_BYVAL ! pfree(DatumGetPointer(d)); ! #endif pgstat_count_index_tuples(scan->indexRelation, ntids);
В списке pgsql-hackers по дате отправления: