38 #include "boehm-gc/include/javaxfc.h"
59 void gc_init(
size_t heapmaxsize,
size_t heapstartsize)
61 size_t heapcurrentsize;
67 GC_java_finalization = 1;
71 GC_all_interior_pointers = 0;
79 GC_finalize_on_demand = 1;
90 GC_set_max_heap_size(heapmaxsize);
95 heapcurrentsize = GC_get_heap_size();
97 if (heapstartsize > heapcurrentsize)
98 GC_expand_hp(heapstartsize - heapcurrentsize);
111 p = GC_MALLOC_UNCOLLECTABLE(size);
115 MSET(p, 0, uint8_t, size);
144 p = GC_MALLOC_ATOMIC(size);
149 if (finalizer != NULL)
154 MSET(p, 0, uint8_t, size);
170 dolog(
"Garbage Collection: previous/now = %d / %d ",
179 return GC_get_heap_size();
185 return GC_get_free_bytes();
197 return GC_get_total_bytes();
209 GC_invoke_finalizers();
231 os::abort(
"gc_out_of_memory: out of memory");
251 #ifdef ENABLE_THREADS
255 struct GC_stack_base sb;
257 if (GC_get_stack_base(&sb) != GC_SUCCESS)
258 vm_abort(
"threads_attach_current_thread: GC_get_stack_base failed");
260 GC_register_my_thread(&sb);
266 #ifdef ENABLE_THREADS
267 GC_unregister_my_thread();
static bool in_gc_out_of_memory
void gc_unregister_current_thread()
void gc_init(u4 heapmaxsize, u4 heapstartsize)
#define RT_TIMER_STOP(var)
Stop the timer var.
#define MSET(ptr, byte, type, num)
#define RT_TIMER_START(var)
Start the timer var.
JNIEnv jthread jobject jclass jlong size
s8 gc_get_free_bytes(void)
#define TRACESUBSYSTEMINITIALIZATION(text)
s8 gc_get_max_heap_size(void)
void vm_abort(const char *text,...)
#define RT_REGISTER_GROUP(var, name, description)
Register a new (toplevel) group.
void * heap_alloc(u4 size, u4 references, methodinfo *finalizer, bool collect)
void gc_invoke_finalizers(void)
void * heap_alloc_uncollectable(u4 size)
void gc_finalize_all(void)
#define RT_REGISTER_GROUP_TIMER(var, name, description, group)
Register a new timer.
s8 gc_get_total_bytes(void)
static size_t gc_max_heap_size
void * gc_out_of_memory(size_t bytes_requested)
void finalizer_run(void *o, void *p)
This file contains the real-time timing utilities.
static void gc_ignore_warnings(char *msg, GC_word arg)
s8 gc_get_heap_size(void)
void gc_register_current_thread()
void exceptions_throw_outofmemoryerror(void)