Posts

Showing posts from November, 2016

Linking native Libraries in Android App

Image
ABI ABI , shorts for Application Binary Interface, is a concept combine the ARM architecture and Instructure set by some formal definition. According to the official document , android support 7 kinds of ABIs, if we want our app to support more android devices, we should package all 7 kinds of ABIs binaries to the package, in this case, it is a linking library. The advantage of this full package is that it can compatible with more devices, the disadvantage is that it enlarged the package size. Also in some situation, the linking library is provided by the third party, missing some ABI types. Then we should use the custom way to implement this app. How get current device's ABI? # ro . product . cpu . abi and ro . product . cpu . abi2 are obsolete , # use ro . product . cpu . abilist instead . ro . product . cpu . abi = armeabi - v7a ro . product . cpu . abi2 = armeabi ro . product . cpu . abilist = armeabi - v7a , armeabi ro . product . cpu . abilist32 = armeabi - v7

Memory Management in Android

Image
Memory in JVM One of the benefits of JVM is the isolation of memory from the host OS, so that if there are some errors in the JVM, the influence is only limited to current JVM process. Actually, the memory in a JVM can be separated to many functional parts, for the simplicity, Heap, and Stack. The Heap is this article's target, Out of Memory Error When the Heap size running to its limitation, the out of Memory Error throws, and the process will crash. It is really easy to repeat this Error, and just write codes to allocate memory repeatedly. while (true) { byte [ ] twn = new byte [ ( int ) ( 1024 L * 1024 L * 20 ) ] ; mLists . add ( twn ) ; } If you write some cache or Memory management app, then it is really the critic part to manage the memory. There are many reasons to trigger this error, serious memory leak or memory limitation, so how to enlarge the memory limitation. java -Xmx:1024m -Xms:512m This is the common way for  a general java command line p