diff options
author | Andreas Gampe <agampe@google.com> | 2014-12-08 16:59:43 -0800 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2014-12-22 10:01:27 -0800 |
commit | e21dc3db191df04c100620965bee4617b3b24397 (patch) | |
tree | 2ad762c6afb024bf95e1eced3d584649a4d57d23 /runtime/common_runtime_test.cc | |
parent | 6d1a047b4b3f9707d4ee1cc19e99717ee021ef48 (diff) | |
download | art-e21dc3db191df04c100620965bee4617b3b24397.zip art-e21dc3db191df04c100620965bee4617b3b24397.tar.gz art-e21dc3db191df04c100620965bee4617b3b24397.tar.bz2 |
ART: Swap-space in the compiler
Introduce a swap-space and corresponding allocator to transparently
switch native allocations to memory backed by a file.
Bug: 18596910
(cherry picked from commit 62746d8d9c4400e4764f162b22bfb1a32be287a9)
Change-Id: I131448f3907115054a592af73db86d2b9257ea33
Diffstat (limited to 'runtime/common_runtime_test.cc')
-rw-r--r-- | runtime/common_runtime_test.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc index 3d7bf53..98fe079 100644 --- a/runtime/common_runtime_test.cc +++ b/runtime/common_runtime_test.cc @@ -84,15 +84,19 @@ int ScratchFile::GetFd() const { return file_->Fd(); } -void ScratchFile::Unlink() { - if (!OS::FileExists(filename_.c_str())) { - return; - } +void ScratchFile::Close() { if (file_.get() != nullptr) { if (file_->FlushCloseOrErase() != 0) { PLOG(WARNING) << "Error closing scratch file."; } } +} + +void ScratchFile::Unlink() { + if (!OS::FileExists(filename_.c_str())) { + return; + } + Close(); int unlink_result = unlink(filename_.c_str()); CHECK_EQ(0, unlink_result); } |