My app constantly runs out of memory and crashes when I am running unit
tests (derived from AndroidTestCase). I seem to have isolated the problem;
the following piece of code shows this in action:
final Pattern pattern =
Pattern.compile("^\\s*[[a-z][A-Z][0-9]]+\\s*\\(");
final String line = new String("Pack my box with five dozen liquor
jugs.");
for (int i = 0; i < 100000; i++) {
pattern.matcher(line);
}
Each time round the for loop leaks about 60 bytes of memory. This is a
genuine leak in the sense that increasing the loop counter eventually makes
the app crash with an 'out of memory' exception.
I am build with API 7 (Android 2.1) and running on an emulator with API 10
(Android 2.3.3). The crash occurs while I am testing the app using Android
InstrumentationTestRunner.
Am I mad ? Am I doing something wrong ?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en