Re: [HACKERS] Re: Nasty resource-leak problem in sort code] - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Re: Nasty resource-leak problem in sort code]
Date
Msg-id 199905072303.TAA14305@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] Re: Nasty resource-leak problem in sort code  (geek+@cmu.edu)
List pgsql-hackers
> Uhm, this all seems unnecessarily complicated.  Shouldn't the process
> look more like this:
> fp = open('tempfile');
> unlink('tempfile');
> 
> This way, when the file is closed, the space is freed.  The only
> complication I can see is if backends need to share the file handle,
> or it needs to be re-opened.  This works with all sorts of temp-file
> situations.
> 
> Of course, it's not NT safe, since I don't believe that NT provides
> for deleting open files (NT file libs sucks.

Two problems.  First, we support NT, so we have to behave a little bit
to keep it happy.  Second, Tom is concerned about leaking file handles,
not just the files themselves.  He needs to call close() to release them
on transaction aborts.

--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Re: Nasty resource-leak problem in sort code
Next
From: Carlos Peralta Ramirez
Date:
Subject: Functions for arrays !!!!