Re: [mini-RFC] Disable opcache per script using "declare(cache=0)"
| From: | Zeev Suraski | Date: | Sun, 25 Nov 2018 21:34:28 +0000 |
| Subject: | Re: [mini-RFC] Disable opcache per script using "declare(cache=0)" | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-103497@lists.php.net to get a copy of this message | ||
On Sun, Nov 25, 2018 at 7:03 AM Marco Pivetta <ocramius@gmail.com> wrote:
> Adding to the pile of "it's an edge case", since the preload scripts will
> be procedural, wouldn't it be sufficient to call
>
opcache_invalidate(__FILE__) at the end of them?
>
> That would actually not do anything useful - as the file will (in all
likelihood) never be accessed again anyway. Invalidating a file only
ensures it won't be fetched again from the opcache - it doesn't actually
free up the space it consumes. Invalidate it or not, in both cases the
outcome is the same - a bit of memory consumed by a file that will never
again be fetched from the opcache. I believe this is what Dmitry's
proposal was about - not putting the file into the opcache to begin with,
to save the bit of memory that it would otherwise consume (but I could be
wrong, as the savings are likely to be so small I'm not sure why we would
care about them...).
Zeev