How to access the Classloaders / App Linearalloc class?

INFO: this is not a LinearAlloc problem that needs to be resolved here!

Hello,

My problem is analyzing LinearAlloc error with excessive bandwidth (1). Although I already have a solution for the error, I still need a way to analyze the size of the running application. I am using Android 4.0.3 (update is not an option), which means that the capacity is 8 MB.

The error occurs at runtime because the application / library loads dynamically (2). In LinearAlloc.cpp (3) on line 306 would be my solution:

LOGVV("--- old=%d size=%d new=%d", startOffset, size, nextOffset);

How to enable VeryVerbose Loglevel mode?

or

Is there any other way to access the used memory size of the bootloader class header bootclasspath (see (3))?

Perhaps from NDK-Api?

If I am informed correctly, this is a memory for class information. A specific memory for this use is what I am looking for.

How much capacity is used and how can it be obtained at run time?

No need to access it in code. I just need a value. If it will be calculated from dumpsys meminfo or DDMS , it will also solve the problem.

Solutions are offered that do not need root!

(1) LinearAlloc exceeded capacity

(2) It is not allowed to post 3 links: google: Custom Classloading Android

(3) LinearAlloc.cpp

Edit: Added NDK-API as a possible solution.

PS This is my first question / message, any suggestions for improvement are welcome.

+4
source share
1 answer

As I know, there is no SDK / NDK API for Dalvik LinearAlloc Size. But you can calculate this size by referring to the Linux / proc // smap interface for more information.

SMAP:

 /dev/ashmem/dalvik-LinearAlloc 

In Dalvik code, the maximum size of a memory card is 16M . And this memory is allocated mmap, so the base unit is 4K. Therefore, if you want to calculate the usage of this memory, use RSS @Smap.

0
source

Source: https://habr.com/ru/post/1445046/


All Articles