Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increasing code cache capacity no ends

Tags:

android

url

While running, i get this in my android monitor, it keeps expanding with no ends :

09-02 14:01:36.150 25666-25671/... I/zygote: Do partial code cache collection, code=30KB, data=27KB
09-02 14:01:36.150 25666-25671/... I/zygote: After code cache collection, code=30KB, data=27KB
09-02 14:01:36.151 25666-25671/... I/zygote: Increasing code cache capacity to 128KB
09-02 14:01:39.064 25666-25671/... I/zygote: Do partial code cache collection, code=59KB, data=53KB
09-02 14:01:39.066 25666-25671/...r I/zygote: After code cache collection, code=59KB, data=53KB
09-02 14:01:39.066 25666-25671/... I/zygote: Increasing code cache capacity to 256KB
09-02 14:01:46.287 25666-25671/... I/zygote: Do full code cache collection, code=123KB, data=94KB
09-02 14:01:46.298 25666-25671/... I/zygote: After code cache collection, code=97KB, data=59KB
09-02 14:01:53.853 25666-25671/... I/zygote: Do partial code cache collection, code=122KB, data=90KB
09-02 14:01:53.853 25666-25671/... I/zygote: After code cache collection, code=122KB, data=90KB
09-02 14:01:53.853 25666-25671/... I/zygote: Increasing code cache capacity to 512KB

Here is the code :

CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL));

for (int i = 0; i < IDs.size(); i++) {
    InputStream inputStream = new URL("https://awebsite/" + IDs.get(i)).openStream();
    inputStream.close();
}
like image 544
Aël Avatar asked Sep 02 '17 14:09

Aël


2 Answers

Problem "fixed", it's working on an real device but not on an emulated one.

like image 60
Aël Avatar answered Nov 19 '22 10:11

Aël


The answer can be found at the official documentations:

https://developer.android.com/topic/performance/memory-overview

The Android Runtime (ART) and Dalvik virtual machine use paging and memory-mapping (mapping) to manage memory. This means that any memory an app modifies—whether by allocating new objects or touching mapped pages—remains resident in RAM and cannot be paged out. The only way to release memory from an app is to release object references that the app holds, making the memory available to the garbage collector.

Garbage collection

A managed memory environment, like the ART or Dalvik virtual machine keeps track of each memory allocation.

In a virtual machine, it's happening but in a Physical device, the result is different. The Garbage collector cleans or needs to clean whatever is not in use anymore.

like image 1
Mauro Rocha Avatar answered Nov 19 '22 10:11

Mauro Rocha