summaryrefslogtreecommitdiffstats
path: root/compiler/image_writer.cc
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-12-04 21:25:04 -0800
committerAndreas Gampe <agampe@google.com>2014-12-05 11:34:21 -0800
commit245ee0030e8e2aebf2231a65a3c475ed43fd4987 (patch)
treee3dc0d99669cd050185ea2da914612ad1017dc36 /compiler/image_writer.cc
parentab74d3eae37de79444edd1edd70400970d5e85ad (diff)
downloadandroid_art-245ee0030e8e2aebf2231a65a3c475ed43fd4987.tar.gz
android_art-245ee0030e8e2aebf2231a65a3c475ed43fd4987.tar.bz2
android_art-245ee0030e8e2aebf2231a65a3c475ed43fd4987.zip
ART: Fix string data leak in image writer
The string intern data is a large object, so it will be recognized as leaking under valgrind. Bug: 18628623 Change-Id: I9090db119a50eebd806a82369bd46527c4e7dbf0
Diffstat (limited to 'compiler/image_writer.cc')
-rw-r--r--compiler/image_writer.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index a45c2d1bab..eb1b5db958 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -548,6 +548,7 @@ void ImageWriter::ProcessStrings() {
}
// Create character array, copy characters and point the strings there.
mirror::CharArray* array = mirror::CharArray::Alloc(self, num_chars);
+ string_data_array_ = array;
uint16_t* array_data = array->GetData();
size_t pos = 0u;
prev_s = nullptr;
@@ -1234,4 +1235,13 @@ uint32_t ImageWriter::BinSlot::GetIndex() const {
return lockword_ & ~kBinMask;
}
+void ImageWriter::FreeStringDataArray() {
+ if (string_data_array_ != nullptr) {
+ gc::space::LargeObjectSpace* los = Runtime::Current()->GetHeap()->GetLargeObjectsSpace();
+ if (los != nullptr) {
+ los->Free(Thread::Current(), reinterpret_cast<mirror::Object*>(string_data_array_));
+ }
+ }
+}
+
} // namespace art