summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/mirror/string.cc6
-rw-r--r--test/061-out-of-memory/expected.txt1
-rw-r--r--test/061-out-of-memory/src/Main.java19
3 files changed, 1 insertions, 25 deletions
diff --git a/runtime/mirror/string.cc b/runtime/mirror/string.cc
index be869d4e6a..45610dccc8 100644
--- a/runtime/mirror/string.cc
+++ b/runtime/mirror/string.cc
@@ -254,11 +254,7 @@ CharArray* String::ToCharArray(Thread* self) {
StackHandleScope<1> hs(self);
Handle<String> string(hs.NewHandle(this));
CharArray* result = CharArray::Alloc(self, GetLength());
- if (result != nullptr) {
- memcpy(result->GetData(), string->GetValue(), string->GetLength() * sizeof(uint16_t));
- } else {
- self->AssertPendingOOMException();
- }
+ memcpy(result->GetData(), string->GetValue(), string->GetLength() * sizeof(uint16_t));
return result;
}
diff --git a/test/061-out-of-memory/expected.txt b/test/061-out-of-memory/expected.txt
index c31980cad7..ca876299f5 100644
--- a/test/061-out-of-memory/expected.txt
+++ b/test/061-out-of-memory/expected.txt
@@ -4,5 +4,4 @@ testOomeLarge beginning
testOomeLarge succeeded
testOomeSmall beginning
testOomeSmall succeeded
-Got expected toCharArray OOM
tests succeeded
diff --git a/test/061-out-of-memory/src/Main.java b/test/061-out-of-memory/src/Main.java
index 52373d3c5f..c812c81114 100644
--- a/test/061-out-of-memory/src/Main.java
+++ b/test/061-out-of-memory/src/Main.java
@@ -26,7 +26,6 @@ public class Main {
testHugeArray();
testOomeLarge();
testOomeSmall();
- testOomeToCharArray();
System.out.println("tests succeeded");
}
@@ -107,22 +106,4 @@ public class Main {
}
System.out.println("testOomeSmall succeeded");
}
-
- private static void testOomeToCharArray() {
- Object[] o = new Object[1000000];
- String test = "test";
- int i = 0;
- try {
- for (; i < o.length; ++i) o[i] = new char[1000000];
- } catch (OutOfMemoryError oom) {}
- try {
- for (; i < o.length; ++i) o[i] = new Object();
- } catch (OutOfMemoryError oom) {}
- try {
- test.toCharArray();
- } catch (OutOfMemoryError oom) {
- o = null;
- System.out.println("Got expected toCharArray OOM");
- }
- }
}