[android-developers] Re: android.os.StrictMode$InstanceCountViolation
The StrictMode source code is available as a download via SDK Manager.
Note that the setClassInstanceLimit message you see in the log is
faked:
// Dummy throwable, for now, since we don't know when or where the
// leaked instances came from. We might in the future, but for
// now we suppress the stack trace because it's useless and/or
// misleading.
private static class InstanceCountViolation extends Throwable {
final Class mClass;
final long mInstances;
final int mLimit;
private static final StackTraceElement[] FAKE_STACK = {
new StackTraceElement("android.os.StrictMode",
"setClassInstanceLimit",
"StrictMode.java", 1)
};
The detectAll method imposes limits on instances of activities,
cursors, and closable (e.g. InputStream) objects:
public Builder detectAll() {
return enable(DETECT_VM_ACTIVITY_LEAKS |
DETECT_VM_CURSOR_LEAKS | DETECT_VM_CLOSABLE_LEAKS);
}
The instance limit for unknown activities seems to be created on the
fly:
Integer expected = sExpectedActivityInstanceCount.get(klass);
Integer newExpected = expected == null ? 1 : expected + 1;
sExpectedActivityInstanceCount.put(klass, newExpected);
My guess is that mobileofficeDispatcher is an Activity, and therefore
limited by the code above to 2 instances.
On Feb 29, 11:10 pm, Roopesh <roopesh.ko...@gmail.com> wrote:
> Hi,
>
> On enabling StrictMode, getting following messages in StrictMode log.
> What does the message mean?
> The test was run on Samsung Galaxt Tab 10.1 with Android OS 3.1 with
> ThreadPolicy & VMPolicy set to detectAll().
>
> 02-05 04:13:45.390: ERROR/StrictMode(15009): class
> com.mo.android.mobileoffice.mobileofficeDispatcher; instances=3;
> limit=2
> 02-05 04:13:45.390: ERROR/StrictMode(15009): android.os.StrictMode
> $InstanceCountViolation: class
> com.mo.android.mobileoffice.mobileofficeDispatcher; instances=3;
> limit=2
> 02-05 04:13:45.390: ERROR/StrictMode(15009): at
> android.os.StrictMode.setClassInstanceLimit(StrictMode.java:1)
>
> regards,
> Roopesh
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home