Re: [HACKERS] Re: Nasty resource-leak problem in sort code]
Bruce Momjian <maillist@candle.pha.pa.us>
From: Bruce Momjian <maillist@candle.pha.pa.us>
To: geek+@cmu.edu
Cc: pgsql-hackers@postgreSQL.org
Date: 1999-05-07T23:03:35Z
Lists: 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, Pennsylvania 19026