GithubHelp home page GithubHelp logo

Comments (2)

CunningLogic avatar CunningLogic commented on July 21, 2024

Complex question, the actual size will vary, certain data can be shared between classes.

For instance, strings, two classes may have the same strings within, but you only get on entry into the string index table.

and some compilers use space saving tricks, such as if two methods have identical dubug info items, they with only write one and and set the debug_info_off to the same offset.

With such data sharing, how do you calculate the size contribution?

from smali.

Lanchon avatar Lanchon commented on July 21, 2024

java class files have a lot of redundancy, especially when they cross-link (eg: when they are part of the same program). java class files are heavily processed during class loading and the VMs are expected to have a very different and more compact representation in memory after loading, with much of this redundancy reduced.

dex files were designed for low memory devices and structured in such a way that they are ready for VM interpretation straight out of the file contents. they can simply be memory mapped and interpreted from there. so much of the java class loader processing needed to load java class files into memory is already done at dex build time when the dex file is constructed. redundancy is reduced and data is shared among classes.

so if A and B are classes, all you can (mostly) say is:
size(dex({A})) + size(dex({B})) >= size(dex({A, B}))
(in reality through, the use of larger indexes in bigger dex files might make that equation not hold.)

from smali.

Related Issues (20)

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.