Message ID | 61483752fe0b46729ae223e928d811924f053a7c.1698751763.git.zhuohao_bai@foxmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | _rpc_dtablesize: decrease to fix excessive memory usage | expand |
diff --git a/src/rpc_dtablesize.c b/src/rpc_dtablesize.c index 12f80c1..e88698f 100644 --- a/src/rpc_dtablesize.c +++ b/src/rpc_dtablesize.c @@ -41,7 +41,9 @@ _rpc_dtablesize(void) static int size; if (size == 0) { - size = min(1024, sysconf(_SC_OPEN_MAX)); + size = sysconf(_SC_OPEN_MAX); + if (size > FD_SETSIZE) + size = FD_SETSIZE; } return (size); } diff --git a/src/svc.c b/src/svc.c index 3a8709f..9b932a5 100644 --- a/src/svc.c +++ b/src/svc.c @@ -657,8 +657,6 @@ svc_getreqset (readfds) assert (readfds != NULL); setsize = _rpc_dtablesize (); - if (setsize > FD_SETSIZE) - setsize = FD_SETSIZE; maskp = readfds->fds_bits; for (sock = 0; sock < setsize; sock += NFDBITS) {
Some users have already taken steps to address this issue. To prevent duplication, we need to remove the modified code and modify the rpc_dtablesize function. Signed-off-by: Zhuohao Bai <zhuohao_bai@foxmail.com> --- src/rpc_dtablesize.c | 4 +++- src/svc.c | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-)