Skip to content

Fix rendering resource cache capacity#18

Merged
EMaksymenko merged 1 commit intoWorldWindEarth:developfrom
EMaksymenko:fix/invalid-resource-cache-capacity
Oct 22, 2019
Merged

Fix rendering resource cache capacity#18
EMaksymenko merged 1 commit intoWorldWindEarth:developfrom
EMaksymenko:fix/invalid-resource-cache-capacity

Conversation

@EMaksymenko
Copy link
Copy Markdown
Member

@EMaksymenko EMaksymenko commented Jun 24, 2019

Description of the Change

Fixed recommended capacity of render resource cache calculation.

Currently render resource cache capacity is calculated using some magic numbers based on total device memory capacity. Using this approach any device with 2GB RAM use 384Mb of resource cache.
But total memory and available application heap are not the same. For example, Samsung Note 9 has 6GB of device RAM, but only 256Mb heap available for each application in standard mode and 512MB in "largeHeap" mode. As you can see 384Mb cache size is much bigger than 256Mb available heap, which cause application crash during intensive use, when cache reaches its capacity limit.
https://stackoverflow.com/questions/2630158/detect-application-heap-size-in-android

Why Should This Be In Core?

This issue is the reason of application crash on many devices with large amount of memory.

Benefits

Fix application crash.

Potential Drawbacks

Incorrect multiplication coefficient may be used, which cause ineffective memory usage on some devices.
I have selected coefficient magic number = 0.75, but in some cases if application itself use very few amount of memory it may ineffectively use available heap, in other hand if application is very heavy and use more then 25% of heap, it may cause memory overflow and crash.

Applicable Issues

Closes #19

@EMaksymenko EMaksymenko changed the title Use application heap limit defined by runtime, instead of total devic… Fix rendering resource cache capacity Jun 24, 2019
…e memory in render resource cache capacity calculation.
@EMaksymenko EMaksymenko merged commit ff92b7d into WorldWindEarth:develop Oct 22, 2019
@EMaksymenko EMaksymenko deleted the fix/invalid-resource-cache-capacity branch October 22, 2019 22:13
EMaksymenko added a commit that referenced this pull request Aug 7, 2022
…-capacity"

This reverts commit ff92b7d, reversing
changes made to 6836432.

# Conflicts:
#	worldwind/src/main/java/gov/nasa/worldwind/WorldWindow.java
#	worldwind/src/main/java/gov/nasa/worldwind/render/RenderResourceCache.java
EMaksymenko added a commit that referenced this pull request Aug 7, 2022
…-capacity"

This reverts commit ff92b7d, reversing
changes made to 6836432.

# Conflicts:
#	worldwind/src/main/java/gov/nasa/worldwind/WorldWindow.java
#	worldwind/src/main/java/gov/nasa/worldwind/render/RenderResourceCache.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible memory leak in Tessellator

1 participant