GithubHelp home page GithubHelp logo

brucewind / operatingimagebypassjavaheap Goto Github PK

View Code? Open in Web Editor NEW
42.0 5.0 2.0 576 KB

Bypassing java heap to operate images,will 100% avoid OOM (Maintenance stopped)绕过java heap操作图片,100%避开OOM

License: Other

Java 0.37% Makefile 0.18% C 99.44%
bitmap android libjpeg dalvik-heap oom memory

operatingimagebypassjavaheap's Introduction

OperatingImageBypassJavaHeap

中文

Announcement regarding discontinued maintenance in 2021:

In devices above Android 8.0, bitmaps store in native heaps. In the future, most devices will keep upgrading to new above 8.0, so this repo will be useless. This is why I have decided to stop maintaining it. I apologize to anyone who looks forward to updates.


The size of physical memory RAM has been increasing for a decade; the limitation of the Java heap exists, though. Furthermore, the camera is improved, and the size of the images that we need to operate keeps increasing. By the way, even though some brands or companies produce phones whose xmx has been modified, the limitations on those devices are still insufficient for immensely large images.

It is a fact that Android's JVMs such as Dalvik and ART accord with JVM standards. So that the Android JVM has a configuration with xmx.

In the README, I don't explain more about what xmx is. You can look into docs or websites for more about it.

Due to the limitation of Java heap for one application, while you operate large bitmaps, the device may throw OOM.

On the other hand, the native heap has no limitation. It is able to allocate reach physical size. So, operating images in the native heap can avoid OOM. In this repo, I bypass Bitmap. In case it bypasses bitmap, it will bypass the Java heap.

To sum up, the native heap is unlimited for every developer. This is why the repo works. All operations of images are in the native heap, which will completely avoid OOM.

The evidence for that the native heap doesn't have limitations.

click to expand

I have tried to allocate numerous memory in the native heap and don't execute free. The allocated memory exceeds 1G, which didn't give rise to OOM.

Below a picture, I run adb shell dumpsys meminfo PACKAGENAME to print that memory information.

The repo progress

  • rotate jpeg

  • compress jpeg

  • resize jpeg

  • compress png (2018.04.10)

    • provide other algorithms about compression, may introduce optipng, which has been used in most services or applications.
  • rotate png

  • resize png

Build tips

  1. before you run on the device, you need to put a test.jpg on external storage.

  2. After you start this app:

    test.jpg ----------compress/rotate---------> test2.jpg

Thanks

base on::bither-android-lib

github:libjpeg-turbo

source.android.com/...../dalvik_vm_properties

sourceforge:libjpeg

operatingimagebypassjavaheap's People

Contributors

brucewind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

tw-frey lzdon

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.