Skip to content

Instantly share code, notes, and snippets.

View isneesh's full-sized avatar

Isneesh Marwah isneesh

View GitHub Profile
@nindalf
nindalf / 01 - Android Memory.md
Last active August 29, 2015 14:04
Android sessions

###Android Memory

To find out how much memory you have available for your app - ActivityManager.getMemoryClass() Android G1 - 16MB Motorola Xoom - 48GB

If you need more, use android:largeHeap = "true"

Can't just ask for more memory though. Using the large heap option and getting more memory means more time spent in garbage collection.

@JakeWharton
JakeWharton / dex.sh
Last active March 25, 2024 13:54
`classes.dex` method count helpers. Requires smali/baksmali from https://code.google.com/p/smali/ and dexdump from the build-tools in the Android SDK be on your PATH.
function dex-method-count() {
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
}
function dex-method-count-by-package() {
dir=$(mktemp -d -t dex)
baksmali $1 -o $dir
for pkg in `find $dir/* -type d`; do
smali $pkg -o $pkg/classes.dex
count=$(dex-method-count $pkg/classes.dex)
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.')