OSDN Git Service
Fix destruction order in Dex2Oat.
In case of a failure (say, --image= pointing to non-existent
directory), the image_writer_ may not be destroyed in
CreateImageFile() and it will be destroyed in Dex2Oat's
destructor instead. However, ImageWriter owns a MemMap, so
it must be destroyed before MemMap::Shutdown() called from
Runtime's destructor. In release builds without leak checks,
we intentionally leak the runtime, so we don't hit the
destruction order issue. However, debug build was crashing
on the DCHECK(maps_ != nullptr) in MemMap destructor.
This change cleans up the destruction order and deliberately
leaks even more owned data in release builds without leak
checks.
Change-Id: Ib7f305bb676589d0379ecaafe6a53eeae208beaa