Documentation ¶
Overview ¶
Package mallocator defines an allocator implementation for memory.Allocator which defers to libc malloc. It requires usage of CGO.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mallocator ¶
type Mallocator struct {
// contains filtered or unexported fields
}
Mallocator is an allocator which defers to libc malloc.
The primary reason to use this is when exporting data across the C Data Interface. CGO requires that pointers to Go memory are not stored in C memory, which is exactly what the C Data Interface would otherwise require. By allocating with Mallocator up front, we can safely export the buffers in Arrow arrays without copying buffers or violating CGO rules.
The build tag 'mallocator' will also make this the default allocator.
func NewMallocator ¶
func NewMallocator() *Mallocator
func (*Mallocator) Allocate ¶
func (alloc *Mallocator) Allocate(size int) []byte
func (*Mallocator) AllocatedBytes ¶
func (alloc *Mallocator) AllocatedBytes() int64
func (*Mallocator) AssertSize ¶
func (alloc *Mallocator) AssertSize(t TestingT, sz int)
func (*Mallocator) Free ¶
func (alloc *Mallocator) Free(b []byte)
func (*Mallocator) Reallocate ¶
func (alloc *Mallocator) Reallocate(size int, b []byte) []byte
Click to show internal directories.
Click to hide internal directories.