int palHeapAllocator::Destroy() { if (internal_) { destroy_mspace(internal_); internal_ = 0; } return 0; }
void PoolAllocator::Terminate() { if(m_mspace == nullptr) return; destroy_mspace(m_mspace); m_mspace = 0; m_poolMemory = nullptr; m_poolMemorySize = 0; }
void ssvm_delete_private (ssvm_private_t * ssvm) { vec_free (ssvm->name); #if USE_DLMALLOC == 0 mheap_free (ssvm->sh->heap); #else destroy_mspace (ssvm->sh->heap); #endif clib_mem_free (ssvm->sh); }
void myhbwmalloc_final(void) { if (myhbwmalloc_mspace != NULL) { size_t bytes_avail = destroy_mspace(myhbwmalloc_mspace); if (myhbwmalloc_verbose) { printf("hbwmalloc: destroy_mspace returned = %zu\n", bytes_avail); } } if (myhbwmalloc_slab != NULL) { numa_free(myhbwmalloc_slab, myhbwmalloc_slab_size); } }
MemoryHeap::~MemoryHeap() { if (mMspace == NULL) return; size_t used = getHeapSize(); size_t freed = destroy_mspace(mMspace); freed += free_allocated(); lassert(used == freed); lassert(mPages.size() == 0); }
void HeapDestroy(MemAllocHeap* heap) { if (heap->m_Flags & HeapFlags::kThreadSafe) { MutexDestroy(&heap->m_Lock); } #if ENABLED(USE_DLMALLOC) destroy_mspace(heap->m_MemSpace); heap->m_MemSpace = nullptr; #endif }
static void hb_mspace_cleanup( void ) { int i; s_gm = NULL; for( i = 0; i < HB_MSPACE_COUNT; ++i ) { if( s_mspool[ i ].ms ) { destroy_mspace( s_mspool[ i ].ms ); s_mspool[ i ].ms = NULL; s_mspool[ i ].count = 0; } } }
void memory_release(int memid) { if (!use_allocator) return; memory_t* memptr = &memory_table[memid]; if (memptr->in_use == 1) { if (memptr->shm_mspace != NULL) destroy_mspace(memptr->shm_mspace); if (memptr->shm_base != NULL) munmap(memptr->shm_base, memptr->mem_size); if (memptr->shm_id >= 0) close(memptr->shm_id); if (memptr->do_create == 1 && need_unlink) shm_unlink(memptr->shm_filename); memptr->in_use = 0; memptr->shm_base = NULL; memptr->client_shm_base = NULL; memptr->shm_mspace = NULL; memptr->shm_id = -1; memptr->mem_size = 0; } }
void mempool_fini() { if (mp_mspace__) destroy_mspace(mp_mspace__); }
/** * clean up memory pool */ void shmemi_mem_finalize (void) { destroy_mspace (myspace); }
int main(int argc, char *argv[]) { size_t size1 = 255; void *addr1 = NULL; size_t size2 = 256; void *addr2 = NULL; size_t size3 = kMaxCodeCacheCapacity - 512; void *addr3 = NULL; gExecutableStore = malloc(kMaxCodeCacheCapacity); if (gExecutableStore == NULL) { printf("error malloc\n"); return -1; } gMspace = create_mspace_with_base(gExecutableStore, kMaxCodeCacheCapacity, /*locked=*/ true); printf("-> create mspace\n"); mspace_malloc_stats(gMspace); addr1 = mspace_malloc(gMspace, size1); if (addr1 != NULL) { printf("-> malloc addr1 = %p, 0x%x\n", addr1, (uint32_t)size1); mspace_malloc_stats(gMspace); printf("addr1 size = 0x%x\n", (uint32_t)mspace_usable_size(addr1)); } addr2 = mspace_malloc(gMspace, size2); if (addr2 != NULL) { printf("-> malloc addr2 = %p, 0x%x\n", addr2, (uint32_t)size2); mspace_malloc_stats(gMspace); printf("addr2 size = 0x%x\n", (uint32_t)mspace_usable_size(addr2)); } addr3 = mspace_malloc(gMspace, size3); if (addr3 != NULL) { printf("-> malloc addr3 = %p, 0x%x\n", addr3, (uint32_t)size3); mspace_malloc_stats(gMspace); printf("addr3 size = 0x%x\n", (uint32_t)mspace_usable_size(addr3)); } else { printf("malloc addr3 error!\n"); } if (addr1 != NULL) { mspace_free(gMspace, addr1); } if (addr2 != NULL) { mspace_free(gMspace, addr2); } if (addr3 != NULL) { mspace_free(gMspace, addr3); } printf("-> all free\n"); mspace_malloc_stats(gMspace); _exit: if (gMspace != NULL) { destroy_mspace(gMspace); gMspace = NULL; } if (gExecutableStore != NULL) { free(gExecutableStore); gExecutableStore = NULL; } return 0; }
OOBase::ArenaAllocator::~ArenaAllocator() { if (m_mspace) destroy_mspace(m_mspace); }
void dlmalloc_mspace_deallocate(void *target) { // substitute destroy_mspace(target); }
mm_shared_space_cleanup(struct mm_shared_space *space) { destroy_mspace(space->space.opaque); }
mm_private_space_cleanup(struct mm_private_space *space) { if (space->reclaim_queue != NULL) mm_ring_spsc_destroy(space->reclaim_queue); destroy_mspace(space->space.opaque); }