Documentation
¶
Index ¶
- Variables
- type BufferAllocator
- func (b *BufferAllocator) Allocate(size uint64, zero bool) (uint64, error)
- func (b *BufferAllocator) Deallocate(offset, size uint64) error
- func (b *BufferAllocator) GetCapacity() uint64
- func (b *BufferAllocator) GetFree() uint64
- func (b *BufferAllocator) GetHeader() *header
- func (b *BufferAllocator) GetOffset(p unsafe.Pointer) uint64
- func (b *BufferAllocator) GetPageOffset(offset uint64) uint64
- func (b *BufferAllocator) GetPtr(pos uint64) unsafe.Pointer
- func (b *BufferAllocator) GetUsed() uint64
- func (b *BufferAllocator) Lock()
- func (b *BufferAllocator) PrintFreeChunks()
- func (b *BufferAllocator) SetBuffer(bufPtr unsafe.Pointer, bufSize uint64, firstFree uint64)
- func (b *BufferAllocator) SetPageSize(s uint16)
- func (b *BufferAllocator) Unlock()
- func (b *BufferAllocator) WLock()
- func (b *BufferAllocator) WUnlock()
- type MemoryManager
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrOutOfMemory = errors.New("Not enough space allocating memory") ErrInvalidSize = errors.New("The requested size is invalid") )
Functions ¶
This section is empty.
Types ¶
type BufferAllocator ¶
type BufferAllocator struct {
// contains filtered or unexported fields
}
BufferAllocator allocates memory in a preallocated buffer
func NewBufferAllocator ¶
func NewBufferAllocator(bufPtr unsafe.Pointer, bufSize uint64, firstFree uint64, pageSize uint16) (*BufferAllocator, error)
NewBufferAllocator created a new buffer allocator
func (*BufferAllocator) Allocate ¶
func (b *BufferAllocator) Allocate(size uint64, zero bool) (uint64, error)
Allocate a new buffer of specific size
func (*BufferAllocator) Deallocate ¶
func (b *BufferAllocator) Deallocate(offset, size uint64) error
func (*BufferAllocator) GetCapacity ¶
func (b *BufferAllocator) GetCapacity() uint64
func (*BufferAllocator) GetFree ¶
func (b *BufferAllocator) GetFree() uint64
func (*BufferAllocator) GetHeader ¶
func (b *BufferAllocator) GetHeader() *header
func (*BufferAllocator) GetPageOffset ¶
func (b *BufferAllocator) GetPageOffset(offset uint64) uint64
func (*BufferAllocator) GetUsed ¶
func (b *BufferAllocator) GetUsed() uint64
func (*BufferAllocator) Lock ¶
func (b *BufferAllocator) Lock()
func (*BufferAllocator) PrintFreeChunks ¶
func (b *BufferAllocator) PrintFreeChunks()
func (*BufferAllocator) SetBuffer ¶
func (b *BufferAllocator) SetBuffer(bufPtr unsafe.Pointer, bufSize uint64, firstFree uint64)
func (*BufferAllocator) SetPageSize ¶
func (b *BufferAllocator) SetPageSize(s uint16)
func (*BufferAllocator) Unlock ¶
func (b *BufferAllocator) Unlock()
func (*BufferAllocator) WLock ¶
func (b *BufferAllocator) WLock()
func (*BufferAllocator) WUnlock ¶
func (b *BufferAllocator) WUnlock()
Click to show internal directories.
Click to hide internal directories.