コード例 #1
0
ファイル: duk_heap_alloc.c プロジェクト: ndob/duktape
void duk_heap_free(duk_heap *heap) {
	DUK_DPRINT("free heap: %p", heap);

	/* Note: heap->heap_thread, heap->curr_thread, heap->heap_object are
	 * on the heap allocated list.
	 */

	DUK_DPRINT("freeing heap objects of heap: %p", heap);
	free_allocated(heap);

#ifdef DUK_USE_REFERENCE_COUNTING
	DUK_DPRINT("freeing refzero list of heap: %p", heap);
	free_refzero_list(heap);
#endif

#ifdef DUK_USE_MARK_AND_SWEEP
	DUK_DPRINT("freeing mark-and-sweep finalize list of heap: %p", heap);
	free_markandsweep_finalize_list(heap);
#endif

	DUK_DPRINT("freeing string table of heap: %p", heap);
	free_stringtable(heap);

	DUK_DPRINT("freeing heap structure: %p", heap);
	heap->free_func(heap->alloc_udata, heap);
}
コード例 #2
0
ファイル: MemoryHeap.cpp プロジェクト: WantonSoup/ufora
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);
	}