File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,14 @@ ARG SKIP_OS_UPDATE=true
64
64
RUN if [ "$SKIP_OS_UPDATE" = "false" ]; then apt-get update; fi
65
65
RUN if [ "$SKIP_OS_UPDATE" = "false" ]; then apt-get upgrade -y; fi
66
66
67
+ ARG DISABLE_JEMALLOC=false
68
+ # Install jemalloc
69
+ RUN if [ "$DISABLE_JEMALLOC" = "false" ]; then \
70
+ apt-get update; \
71
+ apt-get -y install libjemalloc-dev; \
72
+ rm -rf /var/lib/apt/lists/*; \
73
+ fi
74
+
67
75
USER flink
68
76
ENTRYPOINT ["/docker-entrypoint.sh" ]
69
77
CMD ["help" ]
Original file line number Diff line number Diff line change @@ -22,6 +22,27 @@ args=("$@")
22
22
23
23
cd /flink-kubernetes-operator || exit
24
24
25
+ maybe_enable_jemalloc () {
26
+ if [ " ${DISABLE_JEMALLOC:- false} " = " false" ]; then
27
+ JEMALLOC_PATH=" /usr/lib/$( uname -m) -linux-gnu/libjemalloc.so"
28
+ JEMALLOC_FALLBACK=" /usr/lib/x86_64-linux-gnu/libjemalloc.so"
29
+ if [ -f " $JEMALLOC_PATH " ]; then
30
+ export LD_PRELOAD=$LD_PRELOAD :$JEMALLOC_PATH
31
+ elif [ -f " $JEMALLOC_FALLBACK " ]; then
32
+ export LD_PRELOAD=$LD_PRELOAD :$JEMALLOC_FALLBACK
33
+ else
34
+ if [ " $JEMALLOC_PATH " = " $JEMALLOC_FALLBACK " ]; then
35
+ MSG_PATH=$JEMALLOC_PATH
36
+ else
37
+ MSG_PATH=" $JEMALLOC_PATH and $JEMALLOC_FALLBACK "
38
+ fi
39
+ echo " WARNING: attempted to load jemalloc from $MSG_PATH but the library couldn't be found. glibc will be used instead."
40
+ fi
41
+ fi
42
+ }
43
+
44
+ maybe_enable_jemalloc
45
+
25
46
if [ " $1 " = " help" ]; then
26
47
printf " Usage: $( basename " $0 " ) (operator|webhook)\n"
27
48
printf " Or $( basename " $0 " ) help\n\n"
You can’t perform that action at this time.
0 commit comments