MCPcopy Create free account
hub / github.com/alibaba/MNN / onSelectDynamicAllocator

Method onSelectDynamicAllocator

source/backend/cpu/CPUBackend.cpp:544–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

542 mDmaInfo->mCurrentDynamicAllocator->reset();
543}
544bool CPUBackend::onSelectDynamicAllocator(int index, int maxIndex) {
545 if (maxIndex > 2) {
546 return false;
547 }
548 if (maxIndex == 2 && mDmaInfo->mDynamicAllocatorBackup.get() == nullptr) {
549 mDmaInfo->mDynamicAllocatorBackup.reset(mRuntime->createDynamicBufferAlloctor(1));
550 }
551 if (1 == index) {
552 mDmaInfo->mCurrentDynamicAllocator = mDmaInfo->mDynamicAllocatorBackup.get();
553 } else {
554 mRuntime->buffer(0)->release();
555 mDmaInfo->mCurrentDynamicAllocator = mDmaInfo->mDynamicAllocator.get();
556 }
557 mCache = mDmaInfo->mCacheGroup[index].get();
558 return true;
559}
560
561ErrorCode CPUBackend::onResizeEnd() {
562 getCache()->release();

Callers

nothing calls this directly

Calls 5

getMethod · 0.45
resetMethod · 0.45
releaseMethod · 0.45
bufferMethod · 0.45

Tested by

no test coverage detected