Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2 from ollef/master

GC patch
  • Loading branch information...
commit 2f7d394d61eff85cd1cfc9c3a475613551db2c1f 2 parents 9b56d0a + b744d34
Edwin Brady authored
Showing with 15 additions and 5 deletions.
  1. +14 −1 evm/closure.c
  2. +1 −4 evm/stdfuns.c
15 evm/closure.c
View
@@ -15,6 +15,8 @@ VMState* vm;
extern func _do___U__main();
+void epicMemInfo();
+
ALLOCATOR allocate;
REALLOCATOR reallocate;
pool_t** pools = NULL;
@@ -1174,11 +1176,22 @@ VMState* init_evm(int argc, char* argv[])
return vm;
}
+void wrap_GC_free(void * a, size_t b) {
+ GC_free(a);
+}
+
+void* wrap_GC_realloc(void *ptr, size_t old, size_t new) {
+ return GC_realloc(ptr, new);
+}
void epic_main(int argc, char* argv[])
{
GC_init();
+
+
+
vm = init_evm(argc, argv);
+ mp_set_memory_functions(GC_malloc_atomic, wrap_GC_realloc, wrap_GC_free);
// GC_use_entire_heap = 1;
// GC_free_space_divisor = 2;
@@ -1207,7 +1220,7 @@ void epic_main(int argc, char* argv[])
fprintf(stderr, "Warning: roots left %d\n", vm->roots-vm->start_roots);
}
*/
-
+ epicMemInfo();
close_evm(vm);
}
5 evm/stdfuns.c
View
@@ -368,10 +368,7 @@ mpz_t* strToBigInt(char* str)
char* bigIntToStr(mpz_t x)
{
char* str = mpz_get_str(NULL,10,x);
- char* buf = EMALLOC(strlen(str)+1);
- strcpy(buf,str);
- free(str);
- return buf;
+ return str;
}
VAL strToBig(char* str) {
Please sign in to comment.
Something went wrong with that request. Please try again.