[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Simplifying revealed ports
From: |
Ludovic Courtès |
Subject: |
Re: Simplifying revealed ports |
Date: |
Wed, 25 Oct 2017 11:49:12 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
address@hidden (Ludovic Courtès) skribis:
> While debugging <https://bugs.gnu.org/28784>, I was surprised to see
> that revealed ports were not GC’d at all. The manual suggests otherwise
> (info "(guile) Ports and File Descriptors"):
>
> If a port’s revealed count is greater than zero, the file descriptor
> will not be closed when the port is garbage collected.
>
> That revealed ports are not GC’d makes it easy to shoot oneself in the
> foot the way I did (huge memory leak).
>
> So what about the simplification below?
>
> It creates one observable difference: ‘close-port’ does nothing on a
> revealed port, whereas until now it would close the port even if it has
> a non-zero revealed count. I would argue that it’s acceptable though.
Having ‘close-port’ close revealed counts turned out to matter, as shown
by popen.test.
I adjusted the code accordingly, added test cases, and pushed:
https://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.2&id=1008ea315483d1fb41b2a8c10680e511238836d0
Ludo’.