这篇教程C++ GC_get_heap_size函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GC_get_heap_size函数的典型用法代码示例。如果您正苦于以下问题:C++ GC_get_heap_size函数的具体用法?C++ GC_get_heap_size怎么用?C++ GC_get_heap_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GC_get_heap_size函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: InitBagsvoid InitBags(UInt initial_size, Bag * stack_bottom, UInt stack_align){ UInt i; /* loop variable */ /* install the marking functions */ for (i = 0; i < NUM_TYPES; i++) { TabMarkTypeBags[i] = -1; }#ifndef DISABLE_GC#ifdef HPCGAP if (!getenv("GC_MARKERS")) { /* The Boehm GC does not have an API to set the number of * markers for the parallel mark and sweep implementation, * so we use the documented environment variable GC_MARKERS * instead. However, we do not override it if it's already * set. */ static char marker_env_str[32]; unsigned num_markers = 2; if (!SyNumGCThreads) SyNumGCThreads = SyNumProcessors; if (SyNumGCThreads) { if (SyNumGCThreads <= MAX_GC_THREADS) num_markers = (unsigned)SyNumProcessors; else num_markers = MAX_GC_THREADS; } sprintf(marker_env_str, "GC_MARKERS=%u", num_markers); putenv(marker_env_str); }#endif GC_set_all_interior_pointers(0); GC_init(); GC_set_free_space_divisor(1); TLAllocatorInit(); GC_register_displacement(0); GC_register_displacement(sizeof(BagHeader)); initial_size *= 1024; if (GC_get_heap_size() < initial_size) GC_expand_hp(initial_size - GC_get_heap_size()); if (SyStorKill) GC_set_max_heap_size(SyStorKill * 1024);#ifdef HPCGAP AddGCRoots(); CreateMainRegion();#else void * p = ActiveGAPState(); GC_add_roots(p, (char *)p + sizeof(GAPState));#endif for (i = 0; i <= MAX_GC_PREFIX_DESC; i++) { BuildPrefixGCDescriptor(i); /* This is necessary to initialize some internal structures * in the garbage collector: */ GC_generic_malloc(sizeof(BagHeader) + i * sizeof(Bag), GCMKind[i]); }#endif /* DISABLE_GC */}
开发者ID:phs75,项目名称:gap,代码行数:59,
示例2: on_gc_notificationstatic voidon_gc_notification (GCEventType event){ MonoGCEvent e = (MonoGCEvent)event; switch (e) { case MONO_GC_EVENT_PRE_STOP_WORLD: MONO_GC_WORLD_STOP_BEGIN (); mono_thread_info_suspend_lock (); break; case MONO_GC_EVENT_POST_STOP_WORLD: MONO_GC_WORLD_STOP_END (); break; case MONO_GC_EVENT_PRE_START_WORLD: MONO_GC_WORLD_RESTART_BEGIN (1); break; case MONO_GC_EVENT_POST_START_WORLD: MONO_GC_WORLD_RESTART_END (1); mono_thread_info_suspend_unlock (); break; case MONO_GC_EVENT_START: MONO_GC_BEGIN (1);#ifndef DISABLE_PERFCOUNTERS if (mono_perfcounters) mono_perfcounters->gc_collections0++;#endif gc_stats.major_gc_count ++; gc_start_time = mono_100ns_ticks (); break; case MONO_GC_EVENT_END: MONO_GC_END (1);#if defined(ENABLE_DTRACE) && defined(__sun__) /* This works around a dtrace -G problem on Solaris. Limit its actual use to when the probe is enabled. */ if (MONO_GC_END_ENABLED ()) sleep(0);#endif#ifndef DISABLE_PERFCOUNTERS if (mono_perfcounters) { guint64 heap_size = GC_get_heap_size (); guint64 used_size = heap_size - GC_get_free_bytes (); mono_perfcounters->gc_total_bytes = used_size; mono_perfcounters->gc_committed_bytes = heap_size; mono_perfcounters->gc_reserved_bytes = heap_size; mono_perfcounters->gc_gen0size = heap_size; }#endif gc_stats.major_gc_time_usecs += (mono_100ns_ticks () - gc_start_time) / 10; mono_trace_message (MONO_TRACE_GC, "gc took %d usecs", (mono_100ns_ticks () - gc_start_time) / 10); break; } mono_profiler_gc_event (e, 0);}
开发者ID:cjsjy123,项目名称:mono,代码行数:60,
示例3: ml_print_plot_dataGC_USER_FUNC voidml_print_plot_data (void){#if defined(GC_CHERI) unsigned long long heapsyinit = GC_THREAD_LOCAL_HEAP_SIZE, heapsycurr = GC_cheri_getlen(GC_state.thread_local_region.tospace), heapsymaxb = GC_state.thread_local_region.max_grow_size_before_collection, heapsymaxa = GC_state.thread_local_region.max_grow_size_after_collection; printf("[plotdata] # heap size: (young generation) I=%llu B=%llu A=%llu F=%llu/n", heapsyinit, heapsymaxb, heapsymaxa, heapsycurr); #ifdef GC_GENERATIONAL unsigned long long heapsoinit = GC_OLD_GENERATION_SEMISPACE_SIZE, heapsocurr = GC_cheri_getlen(GC_state.old_generation.tospace), heapsomaxb = GC_state.old_generation.max_grow_size_before_collection, heapsomaxa = GC_state.old_generation.max_grow_size_after_collection; printf("[plotdata] # heap size: (old generation) I=%llu B=%llu A=%llu F=%llu/n", heapsoinit, heapsomaxb, heapsomaxa, heapsocurr);#endif // GC_GENERATIONAL#elif defined(GC_BOEHM) printf("[plotdata] # Boehm heap size: %llu/n", (unsigned long long) GC_get_heap_size());#endif}
开发者ID:CTSRD-CHERI,项目名称:CHERI-GC,代码行数:26,
示例4: cleanup_main/* Cleanup */void cleanup_main(void *data){ ScmVM *vm = Scm_VM(); if (profiling_mode) { Scm_ProfilerStop(); Scm_EvalCString("(profiler-show)", SCM_OBJ(Scm_GaucheModule()), NULL); /* ignore errors */ } /* EXPERIMENTAL */ if (stats_mode) { fprintf(stderr, "/n;; Statistics (*: main thread only):/n"); fprintf(stderr, ";; GC: %zubytes heap, %zubytes allocated/n", GC_get_heap_size(), GC_get_total_bytes()); fprintf(stderr, ";; stack overflow*: %ldtimes, %.2fms total/%.2fms avg/n", vm->stat.sovCount, vm->stat.sovTime/1000.0, (vm->stat.sovCount > 0? (double)(vm->stat.sovTime/vm->stat.sovCount)/1000.0 : 0.0)); } /* EXPERIMENTAL */ if (SCM_VM_RUNTIME_FLAG_IS_SET(vm, SCM_COLLECT_LOAD_STATS)) { Scm_Eval(SCM_LIST2(SCM_INTERN("profiler-show-load-stats"), SCM_LIST2(SCM_INTERN("quote"), vm->stat.loadStat)), SCM_OBJ(Scm_GaucheModule()), NULL); /* ignore errors */ }}
开发者ID:h2oota,项目名称:Gauche,代码行数:36,
示例5: on_gc_notificationstatic voidon_gc_notification (GCEventType event){ MonoGCEvent e = (MonoGCEvent)event; if (e == MONO_GC_EVENT_PRE_STOP_WORLD) mono_thread_info_suspend_lock (); else if (e == MONO_GC_EVENT_POST_START_WORLD) mono_thread_info_suspend_unlock (); if (e == MONO_GC_EVENT_START) { if (mono_perfcounters) mono_perfcounters->gc_collections0++; mono_stats.major_gc_count ++; gc_start_time = mono_100ns_ticks (); } else if (e == MONO_GC_EVENT_END) { if (mono_perfcounters) { guint64 heap_size = GC_get_heap_size (); guint64 used_size = heap_size - GC_get_free_bytes (); mono_perfcounters->gc_total_bytes = used_size; mono_perfcounters->gc_committed_bytes = heap_size; mono_perfcounters->gc_reserved_bytes = heap_size; mono_perfcounters->gc_gen0size = heap_size; } mono_stats.major_gc_time_usecs += (mono_100ns_ticks () - gc_start_time) / 10; mono_trace_message (MONO_TRACE_GC, "gc took %d usecs", (mono_100ns_ticks () - gc_start_time) / 10); } mono_profiler_gc_event (e, 0);}
开发者ID:Sciumo,项目名称:mono,代码行数:29,
示例6: initGCjboolean initGC(Options* options) { GC_set_no_dls(1); GC_set_java_finalization(1); GC_INIT(); if (options->maxHeapSize > 0) { GC_set_max_heap_size(options->maxHeapSize); } if (options->initialHeapSize > 0) { size_t now = GC_get_heap_size(); if (options->initialHeapSize > now) { GC_expand_hp(options->initialHeapSize - now); } } objectGCKind = GC_new_kind(GC_new_free_list(), GC_MAKE_PROC(GC_new_proc(markObject), 0), 0, 1); largeArrayGCKind = GC_new_kind(GC_new_free_list(), GC_DS_LENGTH, 1, 1); atomicObjectGCKind = GC_new_kind(GC_new_free_list(), GC_DS_LENGTH, 0, 1); referentEntryGCKind = gcNewDirectBitmapKind(REFERENT_ENTRY_GC_BITMAP); if (rvmInitMutex(&referentsLock) != 0) { return FALSE; } if (rvmInitMutex(&gcRootsLock) != 0) { return FALSE; } GC_set_warn_proc(gcWarnProc); return TRUE;}
开发者ID:tobium,项目名称:robovm,代码行数:30,
示例7: on_gc_heap_resizestatic voidon_gc_heap_resize (size_t new_size){ guint64 heap_size = GC_get_heap_size (); mono_perfcounters->gc_committed_bytes = heap_size; mono_perfcounters->gc_reserved_bytes = heap_size; mono_perfcounters->gc_gen0size = heap_size; mono_profiler_gc_heap_resize (new_size);}
开发者ID:Andrea,项目名称:mono,代码行数:9,
示例8: java_lang_Runtime_totalMemory__JAVA_LONG java_lang_Runtime_totalMemory__(JAVA_OBJECT me){ //XMLVM_BEGIN_NATIVE[java_lang_Runtime_totalMemory__]#ifndef XMLVM_NO_GC return GC_get_heap_size();#else return 0L;#endif //XMLVM_END_NATIVE}
开发者ID:13609594236,项目名称:CrossApp,代码行数:10,
示例9: epicMemInfovoid epicMemInfo() { GC_gcollect(); int heap = GC_get_heap_size(); int free = GC_get_free_bytes(); int total = GC_get_total_bytes(); printf("Heap size %d/n", heap); printf("Heap used %d/n", heap-free); printf("Total allocations %d/n", total);}
开发者ID:avsm,项目名称:EpiVM,代码行数:10,
示例10: ml_print_gc_statsGC_USER_FUNC voidml_print_gc_stats (void){#if defined(GC_CHERI) GC_debug_print_region_stats(&GC_state.thread_local_region);#ifdef GC_GENERATIONAL GC_debug_print_region_stats(&GC_state.old_generation);#endif // GC_GENERATIONAL#elif defined(GC_BOEHM) printf("Boehm heap size: %llu/n", (unsigned long long) GC_get_heap_size());#endif // GC selector}
开发者ID:CTSRD-CHERI,项目名称:CHERI-GC,代码行数:12,
示例11: on_gc_heap_resizestatic voidon_gc_heap_resize (size_t new_size){ guint64 heap_size = GC_get_heap_size ();#ifndef DISABLE_PERFCOUNTERS if (mono_perfcounters) { mono_perfcounters->gc_committed_bytes = heap_size; mono_perfcounters->gc_reserved_bytes = heap_size; mono_perfcounters->gc_gen0size = heap_size; }#endif mono_profiler_gc_heap_resize (new_size);}
开发者ID:cjsjy123,项目名称:mono,代码行数:13,
示例12: mainint main(){ int i; GC_INIT(); /* Optional on Linux/X86; see below. */ for (i = 0; i < 10000000; ++i) { int **p = (int **) GC_MALLOC(sizeof(int *)); int *q = (int *) GC_MALLOC_ATOMIC(sizeof(int)); assert(*p == 0); *p = (int *) GC_REALLOC(q, 2 * sizeof(int)); if (i % 100000 == 0) printf("Heap size = %d/n", GC_get_heap_size()); } return 0;}
开发者ID:heliogabalo,项目名称:The-side-of-the-source,代码行数:16,
示例13: on_gc_notificationstatic voidon_gc_notification (GCEventType event){ if (event == MONO_GC_EVENT_START) { mono_perfcounters->gc_collections0++; mono_stats.major_gc_count ++; gc_start_time = mono_100ns_ticks (); } else if (event == MONO_GC_EVENT_END) { guint64 heap_size = GC_get_heap_size (); guint64 used_size = heap_size - GC_get_free_bytes (); mono_perfcounters->gc_total_bytes = used_size; mono_perfcounters->gc_committed_bytes = heap_size; mono_perfcounters->gc_reserved_bytes = heap_size; mono_perfcounters->gc_gen0size = heap_size; mono_stats.major_gc_time_usecs += (mono_100ns_ticks () - gc_start_time) / 10; mono_trace_message (MONO_TRACE_GC, "gc took %d usecs", (mono_100ns_ticks () - gc_start_time) / 10); } mono_profiler_gc_event ((MonoGCEvent) event, 0);}
开发者ID:massimiliano-mantione,项目名称:mono,代码行数:19,
示例14: initGCjboolean initGC(Options* options) { GC_INIT(); GC_set_java_finalization(1); if (options->maxHeapSize > 0) { GC_set_max_heap_size(options->maxHeapSize); } if (options->initialHeapSize > 0) { size_t now = GC_get_heap_size(); if (options->initialHeapSize > now) { GC_expand_hp(options->initialHeapSize - now); } } object_gc_kind = GC_new_kind(GC_new_free_list(), GC_MAKE_PROC(GC_new_proc(markObject), 0), 0, 1); if (rvmInitMutex(&referentsLock) != 0) { return FALSE; } return TRUE;}
开发者ID:TimurTarasenko,项目名称:robovm,代码行数:21,
示例15: sysGetHeapSizeint64_t sysGetHeapSize() { return GC_get_heap_size();}
开发者ID:linlifengx,项目名称:sparrow,代码行数:3,
示例16: main//.........这里部分代码省略......... "((fn f . (fn g. (f (fn a . (g g) a))) (fn g. (f (fn f . (g g) f)))) (fn f . fn n . if n then n + f (n-1) else 1)) "; GC_CAP char * str2 = ml_malloc(sizeof(str)+strlen(argv[1])); cmemcpy(str2, GC_cheri_ptr(str, sizeof(str)), sizeof(str)); cmemcpy(str2+sizeof(str)-1, GC_cheri_ptr(argv[1], strlen(argv[1]+1)), strlen(argv[1]+1)); */ GC_CAP const char * str2 = GC_cheri_ptr(argv[1], strlen(argv[1])+1); unsigned long long before = ml_time(); lex_read_string(str2); printf("program: %s/n/n", (void*)(str2)); /*size_t i; for (i=0; i<lex_state.max; i++) { putchar(((char*)lex_state.file)[i]); } GC_CAP token_t * t; t = lex(); while (t->type != TKEOF) { printf("[%d] (tag=%d alloc=%d) %s/n", ((token_t*)t)->type, (int) GC_cheri_gettag(((token_t*)t)->str), (int) GC_IS_GC_ALLOCATED(((token_t*)t)->str), (char*) ((token_t*)t)->str); GC_malloc(5000); t = lex(); } printf("Finished/n"); return 0;*/ parse_init(); GC_CAP expr_t * expr = GC_INVALID_PTR(); GC_STORE_CAP(expr, parse()); printf("AST:/n"); print_ast(expr); printf("/nDone printing AST/n"); /*printf("collecting loads/n"); ml_collect(); ml_collect(); ml_collect(); ml_collect(); ml_collect(); ml_collect(); ml_collect(); ml_collect(); ml_collect(); ml_collect(); ml_collect(); ml_collect(); ml_collect(); ml_collect(); ml_collect(); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~done collecting loads/n"); GC_debug_print_region_stats(&GC_state.thread_local_region);*/ GC_CAP val_t * val = GC_INVALID_PTR(); int i; for (i=0; i<10; i++) { GC_STORE_CAP(val, eval(expr, GC_INVALID_PTR())); } unsigned long long after = ml_time(); unsigned long long diff = after - before; printf("eval: "); if (!PTR_VALID(val)) printf("(invalid"); else print_val(val); printf("/n/n"); printf("[plotdata] %s %llu/n", argv[2], (unsigned long long) diff);#ifdef GC_CHERI printf("(young) heap size:/n"); printf("[altplotdata] %s %llu/n", argv[2], (unsigned long long) (GC_cheri_getlen(GC_state.thread_local_region.tospace)));#ifdef GC_GENERATIONAL printf("old heap size:/n"); printf("[altplotdataold] %s %llu/n", argv[2], (unsigned long long) (GC_cheri_getlen(GC_state.old_generation.tospace)));#endif // GC_GENERATIONAL#endif // GC_CHERI#ifdef GC_BOEHM printf("[altplotdata] %s %llu/n", argv[2], (unsigned long long) GC_get_heap_size());#endif // GC_BOEHM ML_STOP_TIMING(main_time, "main()"); ml_print_gc_stats(); ml_print_plot_data(); #ifdef MEMWATCH mwTerm();#endif // MEMWATCH return 0;}
开发者ID:CTSRD-CHERI,项目名称:CHERI-GC,代码行数:101,
示例17: neko_gc_statsEXTERN void neko_gc_stats( int *heap, int *free ) { *heap = (int)GC_get_heap_size(); *free = (int)GC_get_free_bytes();}
开发者ID:MattTuttle,项目名称:neko,代码行数:4,
示例18: mono_gc_get_heap_size/** * mono_gc_get_heap_size: * * Get the amount of memory used by the garbage collector. * * Returns: the size of the heap in bytes */int64_tmono_gc_get_heap_size (void){ return GC_get_heap_size ();}
开发者ID:Sciumo,项目名称:mono,代码行数:12,
示例19: mono_gc_get_used_size/** * mono_gc_get_used_size: * * Get the approximate amount of memory used by managed objects. * * Returns: the amount of memory used in bytes */int64_tmono_gc_get_used_size (void){ return GC_get_heap_size () - GC_get_free_bytes ();}
开发者ID:Sciumo,项目名称:mono,代码行数:12,
示例20: ILGCGetHeapSizelong ILGCGetHeapSize(void){ return (long)GC_get_heap_size();}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:4,
示例21: mainint main() { Node root; Node longLivedTree; Node tempTree; long tStart, tFinish; long tElapsed; int i, d; double *array;#ifdef GC // GC_full_freq = 30; // GC_free_space_divisor = 16; // GC_enable_incremental();#endif printf("Garbage Collector Test/n"); printf(" Live storage will peak at %d bytes./n/n", 2 * sizeof(Node0) * TreeSize(kLongLivedTreeDepth) + sizeof(double) * kArraySize); printf(" Stretching memory with a binary tree of depth %d/n", kStretchTreeDepth); PrintDiagnostics();# ifdef PROFIL init_profiling();# endif tStart = currentTime(); // Stretch the memory space quickly tempTree = MakeTree(kStretchTreeDepth);# ifndef GC destroy_Node(tempTree);# endif tempTree = 0; // Create a long lived object printf(" Creating a long-lived binary tree of depth %d/n", kLongLivedTreeDepth);# ifndef GC longLivedTree = calloc(1, sizeof(Node0));# else longLivedTree = GC_NEW(Node0);# endif Populate(kLongLivedTreeDepth, longLivedTree); ggggc_collectFull(); // Create long-lived array, filling half of it printf(" Creating a long-lived array of %d doubles/n", kArraySize);# ifndef GC array = malloc(kArraySize * sizeof(double));# else# ifndef NO_PTRFREE array = GC_MALLOC_ATOMIC(sizeof(double) * kArraySize);# else array = GC_MALLOC(sizeof(double) * kArraySize);# endif# endif ggggc_collectFull(); for (i = 0; i < kArraySize/2; ++i) { array[i] = 1.0/i; } PrintDiagnostics(); for (d = kMinTreeDepth; d <= kMaxTreeDepth; d += 2) { TimeConstruction(d); } if (longLivedTree == 0 || array[1000] != 1.0/1000) fprintf(stderr, "Failed/n"); // fake reference to LongLivedTree // and array // to keep them from being optimized away tFinish = currentTime(); tElapsed = elapsedTime(tFinish-tStart); PrintDiagnostics(); printf("Completed in %d msec/n", tElapsed);# ifdef GC printf("Completed %d collections/n", GC_gc_no); printf("Heap size is %d/n", GC_get_heap_size());# endif# ifdef PROFIL dump_profile();# endif}
开发者ID:Roshack,项目名称:CS842-Generational-GC,代码行数:83,
示例22: main void main() { Node root; Node longLivedTree; Node tempTree; long tStart, tFinish; long tElapsed;#ifdef GC// GC_full_freq = 30;GC_enable_incremental();#endif cout << "Garbage Collector Test" << endl; cout << " Live storage will peak at " << 2 * sizeof(Node0) * TreeSize(kLongLivedTreeDepth) + sizeof(double) * kArraySize << " bytes." << endl << endl; cout << " Stretching memory with a binary tree of depth " << kStretchTreeDepth << endl; PrintDiagnostics(); tStart = currentTime(); // Stretch the memory space quickly tempTree = MakeTree(kStretchTreeDepth);# ifndef GC delete tempTree;# endif tempTree = 0; // Create a long lived object cout << " Creating a long-lived binary tree of depth " << kLongLivedTreeDepth << endl;# ifndef GC longLivedTree = new Node0();# else longLivedTree = new (GC_NEW(Node0)) Node0();# endif Populate(kLongLivedTreeDepth, longLivedTree); // Create long-lived array, filling half of it cout << " Creating a long-lived array of " << kArraySize << " doubles" << endl;# ifndef GC double *array = new double[kArraySize];# else double *array = (double *) GC_MALLOC_ATOMIC(sizeof(double) * kArraySize);# endif for (int i = 0; i < kArraySize/2; ++i) { array[i] = 1.0/i; } PrintDiagnostics(); for (int d = kMinTreeDepth; d <= kMaxTreeDepth; d += 2){ TimeConstruction(d); } if (longLivedTree == 0 || array[1000] != 1.0/1000) cout << "Failed" << endl; // fake reference to LongLivedTree // and array // to keep them from being optimized away tFinish = currentTime(); tElapsed = elapsedTime(tFinish-tStart); PrintDiagnostics(); cout << "Completed in " << tElapsed << " msec" << endl;# ifdef GC cout << "Completed " << GC_gc_no << " collections" <<endl; cout << "Heap size is " << GC_get_heap_size() << endl;# endif }
开发者ID:GregorR,项目名称:ggggc,代码行数:73,
注:本文中的GC_get_heap_size函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GC_malloc函数代码示例 C++ GC_free函数代码示例 |