summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/mem_darwin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/mem_darwin.c')
-rw-r--r--src/pkg/runtime/mem_darwin.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/pkg/runtime/mem_darwin.c b/src/pkg/runtime/mem_darwin.c
index 7aa607f8e..a75c46d9d 100644
--- a/src/pkg/runtime/mem_darwin.c
+++ b/src/pkg/runtime/mem_darwin.c
@@ -9,14 +9,14 @@
#include "malloc.h"
void*
-runtime·SysAlloc(uintptr n)
+runtime·SysAlloc(uintptr n, uint64 *stat)
{
void *v;
- mstats.sys += n;
v = runtime·mmap(nil, n, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0);
if(v < (void*)4096)
return nil;
+ runtime·xadd64(stat, n);
return v;
}
@@ -28,9 +28,16 @@ runtime·SysUnused(void *v, uintptr n)
}
void
-runtime·SysFree(void *v, uintptr n)
+runtime·SysUsed(void *v, uintptr n)
{
- mstats.sys -= n;
+ USED(v);
+ USED(n);
+}
+
+void
+runtime·SysFree(void *v, uintptr n, uint64 *stat)
+{
+ runtime·xadd64(stat, -(uint64)n);
runtime·munmap(v, n);
}
@@ -51,11 +58,11 @@ enum
};
void
-runtime·SysMap(void *v, uintptr n)
+runtime·SysMap(void *v, uintptr n, uint64 *stat)
{
void *p;
- mstats.sys += n;
+ runtime·xadd64(stat, n);
p = runtime·mmap(v, n, PROT_READ|PROT_WRITE, MAP_ANON|MAP_FIXED|MAP_PRIVATE, -1, 0);
if(p == (void*)ENOMEM)
runtime·throw("runtime: out of memory");