Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(11)

Unified Diff: src/pkg/runtime/malloc.cgo

Issue 257041: code review 257041: runtime: clock garbage collection on bytes allocated, n... (Closed)
Patch Set: code review 257041: runtime: clock garbage collection on bytes allocated, n... Created 15 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/runtime/malloc.h ('k') | src/pkg/runtime/mcache.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/runtime/malloc.cgo
===================================================================
--- a/src/pkg/runtime/malloc.cgo
+++ b/src/pkg/runtime/malloc.cgo
@@ -61,7 +61,7 @@
npages = size >> PageShift;
if((size & PageMask) != 0)
npages++;
- s = MHeap_Alloc(&mheap, npages, 0);
+ s = MHeap_Alloc(&mheap, npages, 0, 1);
if(s == nil)
throw("out of memory");
mstats.alloc += npages<<PageShift;
@@ -74,7 +74,7 @@
m->mallocing = 0;
- if(dogc && mstats.inuse_pages > mstats.next_gc)
+ if(dogc && mstats.heap_alloc >= mstats.next_gc)
gc(0);
return v;
}
@@ -113,7 +113,7 @@
// Large object.
mstats.alloc -= s->npages<<PageShift;
runtime_memclr(v, s->npages<<PageShift);
- MHeap_Free(&mheap, s);
+ MHeap_Free(&mheap, s, 1);
} else {
// Small object.
c = m->mcache;
« no previous file with comments | « src/pkg/runtime/malloc.h ('k') | src/pkg/runtime/mcache.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b