Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for NewArena (0.17 sec)

  1. src/arena/arena.go

    //
    // An Arena must never be used concurrently by multiple goroutines.
    type Arena struct {
    	a unsafe.Pointer
    }
    
    // NewArena allocates a new arena.
    func NewArena() *Arena {
    	return &Arena{a: runtime_arena_newArena()}
    }
    
    // Free frees the arena (and all objects allocated from the arena) so that
    // memory backing the arena can be reused fairly quickly without garbage
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Wed Oct 12 20:23:36 GMT 2022
    - 4.3K bytes
    - Viewed (0)
  2. src/arena/arena_test.go

    func TestSmoke(t *testing.T) {
    	a := arena.NewArena()
    	defer a.Free()
    
    	tt := arena.New[T1](a)
    	tt.n = 1
    
    	ts := arena.MakeSlice[T1](a, 99, 100)
    	if len(ts) != 99 {
    		t.Errorf("Slice() len = %d, want 99", len(ts))
    	}
    	if cap(ts) != 100 {
    		t.Errorf("Slice() cap = %d, want 100", cap(ts))
    	}
    	ts[1].n = 42
    }
    
    func TestSmokeLarge(t *testing.T) {
    	a := arena.NewArena()
    	defer a.Free()
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Wed Oct 12 20:23:36 GMT 2022
    - 742 bytes
    - Viewed (0)
Back to top