diff --git a/src/shrpx_client_handler.h b/src/shrpx_client_handler.h index c441a5bd..bc4d7c27 100644 --- a/src/shrpx_client_handler.h +++ b/src/shrpx_client_handler.h @@ -165,6 +165,9 @@ public: BlockAllocator &get_block_allocator(); private: + // Allocator to allocate memory for connection-wide objects. Make + // sure that the allocations must be bounded, and not proportional + // to the number of requests. BlockAllocator balloc_; Connection conn_; ev_timer reneg_shutdown_timer_; diff --git a/src/shrpx_config.h b/src/shrpx_config.h index 6aa8cab6..527c13b6 100644 --- a/src/shrpx_config.h +++ b/src/shrpx_config.h @@ -659,7 +659,7 @@ struct RateLimitConfig { struct WildcardPattern { WildcardPattern(const StringRef &host) : host(host) {} - // This may not be NULL terminated. Currently it is only used for + // This might not be NULL terminated. Currently it is only used for // comparison. StringRef host; Router router; @@ -693,6 +693,10 @@ struct DownstreamConfig { DownstreamConfig &operator=(const DownstreamConfig &) = delete; DownstreamConfig &operator=(DownstreamConfig &&) = delete; + // Allocator to allocate memory for Downstream configuration. Since + // we may swap around DownstreamConfig in arbitrary times with API + // calls, we should use their own allocator instead of per Config + // allocator. BlockAllocator balloc; struct { ev_tstamp read; @@ -781,6 +785,9 @@ struct Config { Config &operator=(Config &&) = delete; Config &operator=(const Config &&) = delete; + // Allocator to allocate memory for this object except for + // DownstreamConfig. Currently, it is used to allocate memory for + // strings. BlockAllocator balloc; HttpProxy downstream_http_proxy; HttpConfig http;