You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by zt...@apache.org on 2022/10/01 07:58:06 UTC
[hawq] branch master updated: HAWQ-1848. add GPFDIST_APR_MEM_MAX_SIZE to limit memory pool of gpfdist
This is an automated email from the ASF dual-hosted git repository.
ztao1987 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hawq.git
The following commit(s) were added to refs/heads/master by this push:
new 6fd1d32f3 HAWQ-1848. add GPFDIST_APR_MEM_MAX_SIZE to limit memory pool of gpfdist
6fd1d32f3 is described below
commit 6fd1d32f3bcfc694bee11d0f257dfbfd94ca1538
Author: ztao1987 <zh...@gmail.com>
AuthorDate: Sat Oct 1 15:57:31 2022 +0800
HAWQ-1848. add GPFDIST_APR_MEM_MAX_SIZE to limit memory pool of gpfdist
---
src/bin/gpfdist/src/gpfdist/gpfdist.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/bin/gpfdist/src/gpfdist/gpfdist.c b/src/bin/gpfdist/src/gpfdist/gpfdist.c
index 00091c1a7..91492c329 100644
--- a/src/bin/gpfdist/src/gpfdist/gpfdist.c
+++ b/src/bin/gpfdist/src/gpfdist/gpfdist.c
@@ -3444,6 +3444,18 @@ int gpfdist_init(int argc, const char* const argv[]) {
pthread_create(&watchdog, 0, watchdog_thread, 0);
}
}
+
+ char* aprMemStr = getenv("GPFDIST_APR_MEM_MAX_SIZE");
+ long aprMemSize = 0;
+ if (aprMemStr != NULL) {
+ aprMemSize = strtol(aprMemStr, &endptr, 10);
+
+ if (endptr != aprMemStr + strlen(aprMemStr) || aprMemSize > INT_MAX) {
+ fprintf(stderr, "incorrect GPFDIST_APR_MEM_MAX_SIZE: %s\n", aprMemStr);
+ return -1;
+ }
+ apr_allocator_max_free_set(apr_pool_allocator_get(gcb.pool), aprMemSize);
+ }
#endif
return 0;
}