简体   繁体   English

Hibernate + JPA + Spring内存泄漏

[英]Hibernate+JPA+Spring Memory Leak

I am deveoloping a web application with Hibernate, JPA, Spring and Struts2. 我正在使用Hibernate,JPA,Spring和Struts2开发Web应用程序。 When I run the application for a few hours in my web server (VPS Tomcat) the OS send a SIGKILL to tomcat because of the memory usage. 当我在Web服务器(VPS Tomcat)中将应用程序运行几个小时时,由于内存占用,操作系统将SIGKILL发送给tomcat。 My server has 288Mb, tomcat gets killed when it reaches 200Mb aprox. 我的服务器有288Mb,tomcat达到200Mb代理后被杀死。 Someone has told me that I need more memory but my application is small and doesn´t have too much traffic, it is not in production yet. 有人告诉我,我需要更多的内存,但是我的应用程序很小并且没有太多的流量,它还没有投入生产。 I am using postgresql and my database is about 150Mb, it has many images. 我正在使用postgresql,我的数据库约为150Mb,它有很多图像。 I have tried to use a memory profiler with netbeans, but the IDE becomes to slow and I have not been able to find anything. 我试图将内存探查器与netbeans一起使用,但是IDE变慢了,我无法找到任何东西。

I'll appreciate any help. 我将不胜感激。

Do you close properly your connections in a finally block ? 您是否在finally块中正确关闭了连接?

It's hard to reply without the code with only theses informations 没有这些仅包含这些信息的代码就很难答复

i have used JProfiler and yourkit but i am not satisfied with output for actual performance tuning and memory usage currently we have been switched to java melody . 我已经使用了JProfiler和yourkit,但对实际性能调整和内存使用情况的输出不满意,目前我们已切换到java melody This not only help performance optimization in dev but also in production system. 这不仅有助于开发人员优化性能,而且还有助于生产系统中的性能优化。 Java melody is very easy to integrate and configure and in production you can enable or disable by just updating web.xml Java旋律非常易于集成和配置,在生产中,只需更新web.xml即可启用或禁用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM