Spring Boot应用程序不使用jemalloc [英] Spring boot application not using jemalloc

查看:238
本文介绍了Spring Boot应用程序不使用jemalloc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找出内存泄漏问题.我正在追踪本文,并尝试使用jemalloc

I am trying to find out a memory leak issue. I am following this article and trying to use jemalloc

遵循的步骤是:

export LD_PRELOAD=/usr/local/lib/libjemalloc.so
export MALLOC_CONF=prof:true,lg_prof_interval:30,lg_prof_sample:17
sudo java -jar application.jar

但是,没有创建.heap文件.我在pmap -x结果中找不到libjemalloc.so.如何确保jvm正在使用jemalloc?服务器是ubuntu服务器,应用程序正在使用Spring Boot.

However there is no .heap file created. I cannot find libjemalloc.so in pmap -x result. How can I ensure that the jvm is using jemalloc? Server is an ubuntu server and the application is using spring boot.

推荐答案

运行sudo时,Java获得的根环境没有以前导出的LD_PRELOADMALLOC_CONF.

When you run sudo, Java gets root environment which does not have your previously exported LD_PRELOAD and MALLOC_CONF.

尝试

sudo LD_PRELOAD=/usr/local/lib/libjemalloc.so \
     MALLOC_CONF=prof:true,lg_prof_interval:30,lg_prof_sample:17 \
     java -jar application.jar

BTW,jemalloc并不总是对 profiling Java应用程序有用,因为它不能显示Java堆栈(但对于防止标准造成的内存泄漏很有用.分配器).

BTW, jemalloc is not always useful for profiling Java applications, since it cannot show Java stacks (but it is useful for preventing memory leaks caused by the standard allocator).

尝试使用此答案中所述的async-profiler.

Try async-profiler as described in this answer.

还可以查看这篇文章有关Java本机内存消耗的信息.

Also check this post about Java native memory consumption.

这篇关于Spring Boot应用程序不使用jemalloc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆