forked from anbox/platform_art
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix pending exception failure for encoded statics
ReadValueToField may allocate a string and cause OOME, we were not checking this each loop iteration. Throwing an exception with a pending exception causes an abort. Bug: 30690988 Test: test-art-host (cherry picked from commit da595bec0f9af0b087822e4febc282fe8ec28192) Change-Id: I4701a4dcc63553aeb5c7970f99fd7f136443b266
- Loading branch information
Mathieu Chartier
committed
Aug 11, 2016
1 parent
6b9c54c
commit 5464c73
Showing
5 changed files
with
84 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Filling heap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Regression test for encoded static strings caussing OOME b/30690988 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2016 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
Class klass = Other.class; | ||
Object[] data = new Object[100000]; | ||
try { | ||
System.out.println("Filling heap"); | ||
int size = 256 * 1024 * 1024; | ||
int index = 0; | ||
while (true) { | ||
try { | ||
data[index] = new byte[size]; | ||
index++; | ||
} catch (OutOfMemoryError e) { | ||
size /= 2; | ||
if (size == 0) { | ||
break; | ||
} | ||
} | ||
} | ||
// Initialize now that the heap is full. | ||
Other.print(); | ||
} catch (OutOfMemoryError e) { | ||
} catch (Exception e) { | ||
System.err.println(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (C) 2016 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
public final class Other { | ||
public static final String string1 = "ABCDEFG1"; | ||
public static final String string2 = "ABCDEFG2"; | ||
public static final String string3 = "ABCDEFG3"; | ||
public static final String string4 = "ABCDEFG4"; | ||
public static final String string5 = "ABCDEFG5"; | ||
public static final int int1 = 12; | ||
|
||
public static void print() { | ||
System.out.println(string2); | ||
} | ||
} |