/* * Free up the DexFile and any associated data structures. * * Note we may be called with a partially-initialized DvmDex. */ void dvmDexFileFree(DvmDex* pDvmDex) { if (pDvmDex == NULL) return; dexFileFree(pDvmDex->pDexFile); LOGV("+++ DEX %p: freeing aux structs\n", pDvmDex); free(pDvmDex->pResStrings); free(pDvmDex->pResClasses); free(pDvmDex->pResMethods); free(pDvmDex->pResFields); dvmFreeAtomicCache(pDvmDex->pInterfaceCache); sysReleaseShmem(&pDvmDex->memMap); free(pDvmDex); }
/* Free up the DexFile and any associated data structures. Note we may be called with a partially-initialized DvmDex. 释放DEX文件和一些相关数据结构。 注释我们可能调用的部分已初始化的DvmDex。 */ void dvmDexFileFree(DvmDex* pDvmDex) { u4 totalSize; if (pDvmDex == NULL) return; totalSize = pDvmDex->pHeader->stringIdsSize * sizeof(struct StringObject*); totalSize += pDvmDex->pHeader->typeIdsSize * sizeof(struct ClassObject*); totalSize += pDvmDex->pHeader->methodIdsSize * sizeof(struct Method*); totalSize += pDvmDex->pHeader->fieldIdsSize * sizeof(struct Field*); totalSize += sizeof(DvmDex); dexFileFree(pDvmDex->pDexFile); ALOGV("+++ DEX %p: freeing aux structs", pDvmDex); dvmFreeAtomicCache(pDvmDex->pInterfaceCache); sysReleaseShmem(&pDvmDex->memMap); munmap(pDvmDex, totalSize); }
/* * Discard the cache. */ void dvmInstanceofShutdown() { dvmFreeAtomicCache(gDvm.instanceofCache); }