user1318504
user1318504

Reputation: 628

Memory dump an app in android

I'm on a rooted device and want to take a complete memory dump of a certain app.

I've tried:

  1. Some google results say to use "adb kill -10 [pid]" But, it is giving me "sigusr1 forcing gc (no hprof)", and no hproc is dumped. This could be device specific.
  2. I've also tried using "Dump PROF file" button in DDMS (Eclipse), but it only gives me a file that is about 5 MB, this is not a complete memory dump and not very useful.
  3. I've tried to chmod /proc/[pid]/mem, and access that file, but even on a rooted device, it is giving me permission denied.

Upvotes: 5

Views: 10549

Answers (1)

user1643723
user1643723

Reputation: 4192

HPROF is a dump of heap alone, so it is obviously not all memory. As explained here, Android no longer dumps heap on SIGUSR1 (signal 10) in newer versions. Some useful facts on using /proc/[pid]/mem are given here. In short: your "permission denied" may as well be caused by trying to read the file in wrong way.

EDIT: to read anything, other than /proc/self/mem having debug permissions may be extra useful, see this question for some insights.

Upvotes: 0

Related Questions