Nginx allocates directive names from cycle pool

Sambhav Gupta sambhavgupta at microsoft.com
Tue Sep 10 08:50:56 UTC 2024


Hi Nginx experts,

While reviewing the Nginx source code, I noticed that during the conf file parsing, directive names are allocated from the cycle pool.
For instance:
ssl_certificate /path/to/cert/file;

It makes sense to allocate the directive's argument (e.g., the file path) from a pool that persists for the lifetime of the cycle, as modules generally don't clone these arguments but store them directly in their respective confs.
However, wouldn't it be more efficient to allocate the directive name itself from a temporary pool, one that only lives during the configuration parsing process? Since the directive name is only needed for comparison against the module's command array, it seems unnecessary for it to persist for the entire cycle.

I'd appreciate any insights or thoughts on this approach.

Best regards,
Sambhav

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20240910/f2c964ff/attachment.htm>


More information about the nginx-devel mailing list