内存使用率高-应用程序响应速度慢:已用内存值未减少+可用内存值未增加 [英] Memory usages high - Slow application response : Used memory value not decreasing + Free memory value not increasing

查看:142
本文介绍了内存使用率高-应用程序响应速度慢:已用内存值未减少+可用内存值未增加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当应用程序使用了几分钟后,它会慢慢增加已使用的内存值,并减小可用的内存值.几分钟后应用程序变得非常缓慢.为什么不释放内存.

When application is in use for few minutes then it slowly increases the Used memory value and decreases Free memory value. Application get very slow after few minutes. Why isn't it releasing the memory.

系统配置:

  • CPU:2.50GHz @Intel®Xeon®Platinum 8175M CPU(处理器数量:4/cpu内核数量:8)
  • RAM:30 GB
  • 操作系统:CentOS-7

应用程序配置:

  • java版本"1.8.0_171"-构建1.8.0_171-b11
  • apache-tomcat-7.0.55

Tomcat设置

免费-h命令

最高命令

.

已用内存值显示已占用12 GB,可用内存值显示600 MB可用.我执行了多个并发用户搜索,并运行 jcmd 命令以生成heapdump.hprof来分析内存使用情况,并观察到heapdump文件大小不超过600 MB.

Used memory value showing 12 GB occupied and Free memory value showing 600 MB free. I have performed multiple concurrent user searches and run jcmd command to generate heapdump.hprof to analyze the memory usage and observed that heapdump file size is not more than 600 MB.

使用的内存为12 GB,heapdump为600 MB-我不知道为什么内存没有释放或无法释放.

Used memory is 12 GB and heapdump is of 600 MB - I don't know why memory is not releasing or getting free.

任何人都可以请任何有关如何设置/配置以提高特定硬件配置的内存使用情况的阅读建议.

Could any one please advise any read-up on how to setup/configure to improve memory usage for a particular h/w config.

推荐答案

您面临的问题是内存泄漏

这是什么?

在计算机科学中,内存泄漏是一种资源泄漏, 当计算机程序错误地管理内存分配时发生 这样就不会释放不再需要的内存.

In computer science, a memory leak is a type of resource leak that occurs when a computer program incorrectly manages memory allocations in such a way that memory which is no longer needed is not released.

如上所述:不再需要的内存不会被释放

何时发生?

在取消分配分配的堆之前,将ref分配给分配的堆.而ref分配给堆,则垃圾回收将无法寻址分配的堆.无法找到孤立的已分配堆.

when before de-allocation of allocated heap , ref to allocated heap is disposed.while ref to heap is disposed then garbage collection won't be able address to allocated heap.on the other word , it won't be able to find orphaned allocated heap.

在发生内存泄漏的情况下长时间运行的程序会导致什么?

程序将占用RAM和CPU资源

The program will eat RAM , CPU resources

它怎么吃?

程序会不断分配 RAM.但是,不会取消分配它.因此,已用内存变高,导致运行缓慢和慢跑.

The program constantly allocates RAM.But, does not de-allocate it.therefore, Used memory goes high and cause slow & laggy running.

它如何修复?

如果您使用的是 Android Studio ,则该功能的智能功能将通过黄色突出显示来签名可能的部分内存泄漏代码.如果将鼠标悬停在突出显示上,它将弹出并向您显示警告,提示为什么会引起问题.

if you are using Android Studio , The intellisense feature of it, will sign Memory leak possible part of code by Yellow Color highlighting.if you hover on highlight, it will pop-out and shows you warning that why does it might cause problem.

这篇关于内存使用率高-应用程序响应速度慢:已用内存值未减少+可用内存值未增加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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