Another code-based debugging method for tracking memory is displayed in fooobar.com/questions/893197 / ... with a link to a blog with more information.
To do this briefly, you can carefully place the following code (or an improved version) in some kind of click event and get real-time information in a log or message with a toast:
View v = (View) findViewById(R.id.SomeLayout); v.setOnClickListener(new OnClickListener() { public void onClick(View view) { Debug.MemoryInfo memoryInfo = new Debug.MemoryInfo(); Debug.getMemoryInfo(memoryInfo); String memMessage = String.format("App Memory: Pss=%.2f MB, Private=%.2f MB, Shared=%.2f MB", memoryInfo.getTotalPss() / 1024.0, memoryInfo.getTotalPrivateDirty() / 1024.0, memoryInfo.getTotalSharedDirty() / 1024.0); Toast.makeText(ThisActivity.this, memMessage, Toast.LENGTH_LONG).show(); Log.i("log_tag", memMessage); } });
source share