Re: [HACKERS] leaks in TopMemoryContext?

2006-01-11 Thread Neil Conway
On Wed, 2006-01-11 at 02:58 -0500, Tom Lane wrote: One comment is that there are worse things than small memory leaks in seldom-followed code paths, especially if those paths are only taken in error cases. While I agree the problem isn't a showstopper, I think it is still worthy of concern:

Re: [HACKERS] leaks in TopMemoryContext?

2006-01-11 Thread Tom Lane
Neil Conway [EMAIL PROTECTED] writes: While I agree the problem isn't a showstopper, I think it is still worthy of concern: the mbutils example was chosen for being clearly broken, not as being the most serious instance of the problem. The issue might occur in *any* situation in which we're

[HACKERS] leaks in TopMemoryContext?

2006-01-10 Thread Neil Conway
While thinking about how to do memory management for the TupleDesc refcounting changes, it occurred to me that this coding pattern is dangerous: local_var = MemoryContextAlloc(TopMemoryContext, ...); func_call(); /* ... */ /* update global state */ if (global != NULL) pfree(global); global =

Re: [HACKERS] leaks in TopMemoryContext?

2006-01-10 Thread Tom Lane
Neil Conway [EMAIL PROTECTED] writes: Thoughts? One comment is that there are worse things than small memory leaks in seldom-followed code paths, especially if those paths are only taken in error cases. I'm interested in fixing this if it can be done without unreasonable code complication, but