Git Product home page Git Product logo

Comments (4)

Tinaom avatar Tinaom commented on August 15, 2024

同问

from koom.

TokyoAndroid avatar TokyoAndroid commented on August 15, 2024

刚刚测试了一下,自动监测的内存算法是否存在问题呀!(手机华为Mate8)
项目中算法是用Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(),表示用掉的内存,然后用这个值去除以Runtime.getRuntime().maxMemory(),表示用掉的内存占总内存的百分比,若高于80(或其他自定义的值),则表示内存超标。

实际测试如下:
当前我将内存增加后的内存情况:
Runtime.getRuntime().maxMemory() 402 653 184 Runtime.getRuntime().totalMemory() : 33 517 790 Runtime.getRuntime().freeMemory() : 919 662

根据算法测试值:
HeapMonitor: 占用比8.095833(结果已经乘以100了) 阈值:85.0
那么,如果是自动监测的话,我的手机永远不可能触发内存分析了 。。。。

from koom.

AndroidInternal avatar AndroidInternal commented on August 15, 2024

Q:在内存超过阈值3次之后去抓取的,对吗?

A:对的。

Q:App在打开过程中,只能抓取一次数据吗?

A:是的。

Q:如果是自动监测的话,我的手机永远不可能触发内存分析

A:没理解你的问题。宗旨就是会在濒临OOM时触发,查找出有问题的内存占用,8%的内存占用很正常不会触发分析。

from koom.

TokyoAndroid avatar TokyoAndroid commented on August 15, 2024

Q:在内存超过阈值3次之后去抓取的,对吗?

A:对的。

Q:App在打开过程中,只能抓取一次数据吗?

A:是的。

Q:如果是自动监测的话,我的手机永远不可能触发内存分析

A:没理解你的问题。宗旨就是会在濒临OOM时触发,查找出有问题的内存占用,8%的内存占用很正常不会触发分析。

如果是自动监测的话,我的手机永远不可能触发内存分析——这个可以忽略了,是我自己计算错了,我把freeMemory当成了App剩余可用内存。现在已经弄清楚了,谢谢大佬解答!

from koom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.