Lines Matching defs:memory
46 FALSE_RETURN_V_MSG_E(!inited_, -1, "memory pool has inited.");
58 auto memory = AllocMemory(option_.memSize);
59 FALSE_RETURN_V_MSG_E(memory != nullptr, -1, "failed to AllocMemory");
60 idleList_.push_back(memory);
70 AVSharedMemoryBase *memory = new (std::nothrow) AVSharedMemoryBase(size, option_.flags, name_);
71 FALSE_RETURN_V_MSG_E(memory != nullptr, nullptr, "create object failed");
72 ON_SCOPE_EXIT(0) { delete memory; };
73 memory->Init();
74 int32_t ret = memory->Init();
78 return memory;
81 void AVSharedMemoryPool::ReleaseMemory(AVSharedMemory *memory)
83 FALSE_LOG_MSG(memory != nullptr, "memory is nullptr");
87 if (*iter != memory) {
92 idleList_.push_back(memory);
95 FAKE_POINTER(memory), name_.c_str());
104 MEDIA_LOG_E("0x%{public}06" PRIXPTR " is no longer managed by this pool", FAKE_POINTER(memory));
105 delete memory;
176 MEDIA_LOG_D("acquire memory for size: %{public}d from pool %{public}s, blocking: %{public}d",
186 AVSharedMemory *memory = nullptr;
188 if (!DoAcquireMemory(size, &memory) || memory != nullptr) {
199 FALSE_RETURN_V_MSG_E(memory != nullptr, nullptr, "acquire memory failed for size: %{public}d", size);
200 busyList_.push_back(memory);
202 auto result = std::shared_ptr<AVSharedMemory>(memory, [weakPool = weak_from_this()](AVSharedMemory *memory) {
205 pool->ReleaseMemory(memory);
207 MEDIA_LOG_I("release memory 0x%{public}06" PRIXPTR ", but the pool is destroyed", FAKE_POINTER(memory));
208 delete memory;
212 MEDIA_LOG_D("0x%{public}06" PRIXPTR " acquired from pool", FAKE_POINTER(memory));
231 for (auto &memory : idleList_) {
232 delete memory;
233 memory = nullptr;
240 // for busylist, the memory will be released when the refcount of shared_ptr is zero.