diff --git a/es2panda/compiler/core/compileQueue.cpp b/es2panda/compiler/core/compileQueue.cpp index 6a6ddeab5a6485bceef5417d9a977f2f5ade4acb..46739bbe065190ecd939991800ede55b94b031b8 100644 --- a/es2panda/compiler/core/compileQueue.cpp +++ b/es2panda/compiler/core/compileQueue.cpp @@ -106,8 +106,12 @@ bool CompileFileJob::RetrieveProgramFromCacheFiles(const std::string &buffer, bo cacheFileIter->second, &allocator); if (cacheAbcProgramsInfo != nullptr && cacheAbcProgramsInfo->hashCode == src_->hash) { InsertAbcCachePrograms(src_->hash, cacheAbcProgramsInfo->programsCache); + delete cacheAbcProgramsInfo; + cacheAbcProgramsInfo = nullptr; return true; } + delete cacheAbcProgramsInfo; + cacheAbcProgramsInfo = nullptr; } } return false; @@ -185,9 +189,11 @@ void CompileFileJob::CompileAbcFileJobInParallel(es2panda::Compiler &compiler) panda::Timer::timerStart(panda::EVENT_UPDATE_ABC_PROG_CACHE, src_->fileName); auto outputCacheIter = options_->cacheFiles.find(src_->fileName); if (!options_->requireGlobalOptimization && outputCacheIter != options_->cacheFiles.end()) { - auto *cache = allocator_->New(src_->hash, abcProgramsInfo); + auto *cache = new panda::es2panda::util::AbcProgramsCache(src_->hash, abcProgramsInfo); CHECK_NOT_NULL(cache); panda::proto::ProtobufSnapshotGenerator::UpdateAbcCacheFile(cache, outputCacheIter->second); + delete cache; + cache = nullptr; } InsertAbcCachePrograms(src_->hash, abcProgramsInfo); panda::Timer::timerEnd(panda::EVENT_UPDATE_ABC_PROG_CACHE, src_->fileName); diff --git a/merge_abc/src/protobufSnapshotGenerator.cpp b/merge_abc/src/protobufSnapshotGenerator.cpp index 11507c8fa5a0c72785cdb0f96d4d1409923d3029..5722f3c26eafe9a09d6395212b42da3f8977c432 100644 --- a/merge_abc/src/protobufSnapshotGenerator.cpp +++ b/merge_abc/src/protobufSnapshotGenerator.cpp @@ -107,7 +107,7 @@ panda::es2panda::util::AbcProgramsCache *ProtobufSnapshotGenerator::GetAbcInputC } uint32_t hashCode = abcProtoCache.hashcode(); - auto *abcProgarmsCache = allocator->New(hashCode, abcProgsInfo); + auto *abcProgarmsCache = new panda::es2panda::util::AbcProgramsCache(hashCode, abcProgsInfo); CHECK_NOT_NULL(abcProgarmsCache); return abcProgarmsCache;