Re: Detoasting and memory usage
От | Joe Conway |
---|---|
Тема | Re: Detoasting and memory usage |
Дата | |
Msg-id | 3F1A24E8.8050302@joeconway.com обсуждение исходный текст |
Ответ на | Detoasting and memory usage (apb18@cornell.edu) |
Ответы |
Re: Detoasting and memory usage
|
Список | pgsql-general |
apb18@cornell.edu wrote: > I guess my situation is an odd fringe case that probably doesn't happen > too much, but I thought that knowledge of it might be useful to someone > somewhere. See PG_FREE_IF_COPY in fmgr.h /* * Support for cleaning up detoasted copies of inputs. This must only * be used for pass-by-ref datatypes, and normally would only be used * for toastable types. If the given pointer is different from the * original argument, assume it's a palloc'd detoasted copy, and pfree * it. * * NOTE: most functions on toastable types do not have to worry about * this, but we currently require that support functions for indexes * not leak memory. */ #define PG_FREE_IF_COPY(ptr,n) \ do { \ if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \ pfree(ptr); \ } while (0) Maybe you can use that or do something similar? HTH, Joe
В списке pgsql-general по дате отправления: