gc: enable on macos and add leak detection fns
							parent
							
								
									5873149c77
								
							
						
					
					
						commit
						4d77f3810f
					
				| 
						 | 
				
			
			@ -9,10 +9,16 @@ $if windows {
 | 
			
		|||
 | 
			
		||||
#include <gc.h>
 | 
			
		||||
 | 
			
		||||
#flag -lgc
 | 
			
		||||
#flag linux -lgc
 | 
			
		||||
#flag darwin @VROOT/thirdparty/bdwgc/extra/.libs/gc.o
 | 
			
		||||
 | 
			
		||||
fn C.GC_MALLOC(n size_t) voidptr
 | 
			
		||||
 | 
			
		||||
fn C.GC_REALLOC(ptr voidptr, n size_t) voidptr
 | 
			
		||||
 | 
			
		||||
fn C.GC_FREE(ptr voidptr)
 | 
			
		||||
 | 
			
		||||
fn C.GC_set_find_leak(int)
 | 
			
		||||
 | 
			
		||||
// fn C.CHECK_LEAKS()
 | 
			
		||||
fn C.GC_gcollect()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5168,7 +5168,7 @@ fn (mut g Gen) write_init_function() {
 | 
			
		|||
		// g.writeln('g_str_buf = malloc( ${mb_size} * 1024 * 1000 );')
 | 
			
		||||
	}
 | 
			
		||||
	if g.pref.prealloc {
 | 
			
		||||
		g.writeln('g_m2_buf = malloc(50 * 1000 * 1000);')
 | 
			
		||||
		g.writeln('g_m2_buf = malloc(150 * 1000 * 1000);')
 | 
			
		||||
		g.writeln('g_m2_ptr = g_m2_buf;')
 | 
			
		||||
	}
 | 
			
		||||
	// NB: the as_cast table should be *before* the other constant initialize calls,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue