• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GC_get_heap_size函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GC_get_heap_size函数的典型用法代码示例。如果您正苦于以下问题:C++ GC_get_heap_size函数的具体用法?C++ GC_get_heap_size怎么用?C++ GC_get_heap_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GC_get_heap_size函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: InitBags

void 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,代码来源:boehm_gc.c


示例2: on_gc_notification

static void
on_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,代码来源:boehm-gc.c


示例3: ml_print_plot_data

GC_USER_FUNC void
ml_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,代码来源:ml.c


示例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,代码来源:main.c


示例5: on_gc_notification

static void
on_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,代码来源:boehm-gc.c


示例6: initGC

jboolean 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,代码来源:memory.c


示例7: on_gc_heap_resize

static void
on_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,代码来源:boehm-gc.c


示例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,代码来源:native_java_lang_Runtime.c


示例9: epicMemInfo

void 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,代码来源:stdfuns.c


示例10: ml_print_gc_stats

GC_USER_FUNC void
ml_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,代码来源:ml.c


示例11: on_gc_heap_resize

static void
on_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,代码来源:boehm-gc.c


示例12: main

int 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,代码来源:realloc-exem.c


示例13: on_gc_notification

static void
on_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,代码来源:boehm-gc.c


示例14: initGC

jboolean 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,代码来源:memory.c


示例15: sysGetHeapSize

int64_t sysGetHeapSize() {
	return GC_get_heap_size();
}
开发者ID:linlifengx,项目名称:sparrow,代码行数:3,代码来源:sysapi.c


示例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,代码来源:ml.c


示例17: neko_gc_stats

EXTERN void neko_gc_stats( int *heap, int *free ) {
	*heap = (int)GC_get_heap_size();
	*free = (int)GC_get_free_bytes();
}
开发者ID:MattTuttle,项目名称:neko,代码行数:4,代码来源:alloc.c


示例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_t
mono_gc_get_heap_size (void)
{
	return GC_get_heap_size ();
}
开发者ID:Sciumo,项目名称:mono,代码行数:12,代码来源:boehm-gc.c


示例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_t
mono_gc_get_used_size (void)
{
	return GC_get_heap_size () - GC_get_free_bytes ();
}
开发者ID:Sciumo,项目名称:mono,代码行数:12,代码来源:boehm-gc.c


示例20: ILGCGetHeapSize

long ILGCGetHeapSize(void)
{
	return (long)GC_get_heap_size();
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:4,代码来源:hb_gc.c



注:本文中的GC_get_heap_size函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GC_malloc函数代码示例发布时间:2022-05-30
下一篇:
C++ GC_free函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap