int main() { LinkedListInit( & queueList ); LinkedListInit( & stackList ); AtomicListInit( & atomicList ); HeapInit( & heap ); int data; do { printf("enter a data value:\n0 to exit\n1 to remove a node\n2 to print the data structures\nor a larger number to add a node.\n"); scanf("%d", &data ); if( data == 0 ) return 0; else if( data == 1 ) Pop(); else if( data == 2 ) { printf("queue:"); DumpList( & queueList ); printf("stack:"); DumpList( & stackList ); printf("Atomic:"); DumpAtomic( &atomicList ); DumpHeap( & heap ); } else Add(data); }while( data != 0 ); return 0; }
JSBool DumpHeaps(JSContext* cx, uintN argc, jsval* vp) { UNUSED2(cx); UNUSED2(argc); #if MOZJS_DEBUG_ABI static int i = 0; if (ScriptingHost::IsInitialised()) DumpHeap("gui", i, g_ScriptingHost.GetContext()); if (g_Game) DumpHeap("sim", i, g_Game->GetSimulation2()->GetScriptInterface().GetContext()); ++i; #else debug_warn(L"DumpHeaps only available in DEBUG mode"); #endif JS_SET_RVAL(cx, vp, JSVAL_VOID); return JS_TRUE; }
void PrintInfo(){ tHeapInfo inf; DumpHeap(); GetInfo(tHeapInfo$D,&inf); printf("Start = %i\n",inf.Start ); printf("End = %i\n",inf.End ); printf("TotalBytes = %i\n",inf.TotalBytes ); printf("TotalFreeBytes = %i\n",inf.TotalFreeBytes); printf("MaxFreeBytes = %i\n",inf.MaxFreeBytes ); printf("NofFreeBlocks = %i\n",inf.NofFreeBlocks ); } /* PrintInfo */