diff options
author | Russ Cox <rsc@golang.org> | 2009-12-03 17:22:23 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-12-03 17:22:23 -0800 |
commit | 4a513fd3b4a6cd780a7de1f217b64e4f19020ee7 (patch) | |
tree | db4e0630cae7b1362353ffd8921a0df25b970082 /src/pkg/runtime/malloc.h | |
parent | 7b84abbf8b1f77341fabf1bbe88c1b629c9b2165 (diff) | |
download | golang-4a513fd3b4a6cd780a7de1f217b64e4f19020ee7.tar.gz |
runtime: malloc fixes
* throw away dead code
* add mlookup counter
* add malloc counter
* set up for blocks with no pointers
Fixes issue 367.
R=r
http://codereview.appspot.com/165050
Diffstat (limited to 'src/pkg/runtime/malloc.h')
-rw-r--r-- | src/pkg/runtime/malloc.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pkg/runtime/malloc.h b/src/pkg/runtime/malloc.h index 5b657a495..2e0f1143d 100644 --- a/src/pkg/runtime/malloc.h +++ b/src/pkg/runtime/malloc.h @@ -163,6 +163,8 @@ struct MStats uint64 stacks; uint64 inuse_pages; // protected by mheap.Lock uint64 next_gc; // protected by mheap.Lock + uint64 nlookup; // unprotected (approximate) + uint64 nmalloc; // unprotected (approximate) bool enablegc; }; extern MStats mstats; @@ -271,6 +273,10 @@ struct MHeap // span lookup MHeapMap map; MHeapMapCache mapcache; + + // range of addresses we might see in the heap + byte *min; + byte *max; // central free lists for small size classes. // the union makes sure that the MCentrals are @@ -292,6 +298,7 @@ void MHeap_Free(MHeap *h, MSpan *s); MSpan* MHeap_Lookup(MHeap *h, PageID p); MSpan* MHeap_LookupMaybe(MHeap *h, PageID p); +void* mallocgc(uintptr size, uint32 flag, int32 dogc); int32 mlookup(void *v, byte **base, uintptr *size, uint32 **ref); void gc(int32 force); @@ -300,9 +307,9 @@ enum RefcountOverhead = 4, // one uint32 per object RefFree = 0, // must be zero - RefManual, // manual allocation - don't free RefStack, // stack segment - don't free and don't scan for pointers RefNone, // no references RefSome, // some references + RefNoPointers = 0x80000000U, // flag - no pointers here }; |