for some quick and dirty in-app measurements you can use
int usedMegs = (int) (Debug.getNativeHeapAllocatedSize() / 1048576L);
On Mar 2, 10:16 am, GDroid wrote:
> Hi all,
>
> Recently I decided to check how much memory my application is using.
> For the first test I started my application and went back to the "running
> services" screen to check my process's memory. I got ~11MB.
> It seemed too much in my opinion.
> I used the "Dump HPROF file" from the DDMS menu, opened MAT and found the
> following stats:
> "Size: 2.3 MB Classes: 3.4k Objects: 60.5k".
>
> So my first question is: Where is the rest 9MB?
>
> I searched the Web for more information and came up with this good
> post:http://stackoverflow.com/questions/2298208/how-to-discover-memory-usa...
>
> So I ran: "adb shell dumpsys meminfo" - the results are at the end of the
> post.
>
> I can't find my way between all the numbers.
> So my second question is "how much memory my app is really using ? and how
> can I see what is consuming the memory?"
>
> Any help will be appreciated.
>
> MemInfo results:
>
> ** MEMINFO in pid 2758 [xx] **
>
> native dalvik other total
>
> size: 6872 5191 N/A 12063
>
> allocated: 6088 4194 N/A 10282
>
> free: 47 997 N/A 1044
> (Pss): 1547 6495 3121 11163
> (shared dirty): 2688 4296 1016 8000
>
> (priv dirty): 1468 3304 1916 6688
>
> Objects
>
> Views: 59 ViewRoots: 0
>
> AppContexts: 4 Activities: 2
>
> Assets: 2 AssetManagers: 2
>
> Local Binders: 40 Proxy Binders: 47
> Death Recipients: 0
>
> OpenSSL Sockets: 0
>
> SQL
>
> heap: 85 dbFiles: 0
>
> numPagers: 1 inactivePageKB: 62
>
> activePageKB: 0
>
> Asset Allocations
> zip:/data/app/xx.apk:/resources.arsc: 166K
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en