type mcache … type gclink … type gclinkptr … // ptr returns the *gclink form of p. // The result should be used for accessing fields, not stored // in other data structures. func (p gclinkptr) ptr() *gclink { … } type stackfreelist … var emptymspan … func allocmcache() *mcache { … } // freemcache releases resources associated with this // mcache and puts the object onto a free list. // // In some cases there is no way to simply release // resources, such as statistics, so donate them to // a different mcache (the recipient). func freemcache(c *mcache) { … } // getMCache is a convenience function which tries to obtain an mcache. // // Returns nil if we're not bootstrapping or we don't have a P. The caller's // P must not change, so we must be in a non-preemptible state. func getMCache(mp *m) *mcache { … } // refill acquires a new span of span class spc for c. This span will // have at least one free object. The current span in c must be full. // // Must run in a non-preemptible context since otherwise the owner of // c could change. func (c *mcache) refill(spc spanClass) { … } // allocLarge allocates a span for a large object. func (c *mcache) allocLarge(size uintptr, noscan bool) *mspan { … } func (c *mcache) releaseAll() { … } // prepareForSweep flushes c if the system has entered a new sweep phase // since c was populated. This must happen between the sweep phase // starting and the first allocation from c. func (c *mcache) prepareForSweep() { … }