Documentation ¶
Index ¶
- Constants
- func NewFixedSizeMmapAllocator(size uint64) *fixedSizeMmapAllocator
- func NewFixedSizeSyncPoolAllocator(size uint64) *fixedSizeSyncPoolAllocator
- func SetDefaultConfig(delta Config)
- type AllocateInfo
- type Allocator
- type AtomicInteger
- type CAllocator
- type CheckedAllocator
- type Class
- type ClassAllocator
- type Config
- type CounterInteger
- type Deallocator
- type FixedSizeAllocator
- type FuncDeallocator
- type FunctionKey
- type HeapSampleValues
- type Hints
- type LocationKey
- type MetricsAllocator
- type ProfileAllocator
- type Profiler
- type SampleInfo
- type SampleKey
- type SampleValues
- type ShardedAllocator
- type ShardedCounter
- type SizeBoundedAllocator
Constants ¶
View Source
const ( MB = 1 << 20 GB = 1 << 30 )
Variables ¶
This section is empty.
Functions ¶
func NewFixedSizeMmapAllocator ¶ added in v1.2.1
func NewFixedSizeMmapAllocator( size uint64, ) *fixedSizeMmapAllocator
func NewFixedSizeSyncPoolAllocator ¶ added in v1.2.1
func NewFixedSizeSyncPoolAllocator(size uint64) *fixedSizeSyncPoolAllocator
func SetDefaultConfig ¶ added in v1.2.1
func SetDefaultConfig(delta Config)
Types ¶
type AllocateInfo ¶ added in v1.2.1
type AllocateInfo struct { Deallocator Deallocator Size uint64 }
type Allocator ¶ added in v1.2.1
func GetDefault ¶ added in v1.2.1
type AtomicInteger ¶ added in v1.2.1
type AtomicInteger[T any] interface { Add(T) T Load() T }
type CAllocator ¶ added in v1.2.1
type CAllocator struct { }
func NewCAllocator ¶ added in v1.2.1
func NewCAllocator() *CAllocator
func (*CAllocator) Allocate ¶ added in v1.2.1
func (c *CAllocator) Allocate(size uint64, hints Hints) (unsafe.Pointer, Deallocator, error)
func (*CAllocator) Deallocate ¶ added in v1.2.1
func (c *CAllocator) Deallocate(ptr unsafe.Pointer, hints Hints)
type CheckedAllocator ¶ added in v1.2.1
type CheckedAllocator struct {
// contains filtered or unexported fields
}
func NewCheckedAllocator ¶ added in v1.2.1
func NewCheckedAllocator(upstream Allocator, fraction uint32) *CheckedAllocator
func (*CheckedAllocator) Allocate ¶ added in v1.2.1
func (c *CheckedAllocator) Allocate(size uint64, hints Hints) (unsafe.Pointer, Deallocator, error)
type Class ¶ added in v1.2.1
type Class[T FixedSizeAllocator] struct { // contains filtered or unexported fields }
type ClassAllocator ¶ added in v1.2.1
type ClassAllocator[T FixedSizeAllocator] struct { // contains filtered or unexported fields }
func NewClassAllocator ¶ added in v1.2.1
func NewClassAllocator[T FixedSizeAllocator]( newAllocator func(size uint64) T, ) *ClassAllocator[T]
func (*ClassAllocator[T]) Allocate ¶ added in v1.2.1
func (c *ClassAllocator[T]) Allocate(size uint64, hints Hints) (unsafe.Pointer, Deallocator, error)
type Config ¶ added in v1.2.1
type Config struct { // Allocator controls which allocator to use Allocator *string `toml:"allocator"` // CheckFraction controls the fraction of checked deallocations // On average, 1 / fraction of deallocations will be checked for double free or missing free CheckFraction *uint32 `toml:"check-fraction"` // FullStackFraction controls the fraction of full stack collecting in profile sampling // On average, 1 / fraction of allocations will be sampled with full stack information FullStackFraction *uint32 `toml:"full-stack-fraction"` // EnableMetrics indicates whether to expose metrics to prometheus EnableMetrics *bool `toml:"enable-metrics"` }
type CounterInteger ¶ added in v1.2.1
type Deallocator ¶ added in v1.2.1
func ChainDeallocator ¶ added in v1.2.1
func ChainDeallocator(dec1 Deallocator, dec2 Deallocator) Deallocator
type FixedSizeAllocator ¶ added in v1.2.1
type FixedSizeAllocator interface {
Allocate(hint Hints) (unsafe.Pointer, Deallocator, error)
}
type FuncDeallocator ¶ added in v1.2.1
func (FuncDeallocator) Deallocate ¶ added in v1.2.1
func (f FuncDeallocator) Deallocate(ptr unsafe.Pointer, hints Hints)
type FunctionKey ¶ added in v1.2.1
type FunctionKey struct {
Name string
}
type HeapSampleValues ¶ added in v1.2.1
type HeapSampleValues struct { AllocatedObjects ShardedCounter[int64, atomic.Int64, *atomic.Int64] AllocatedBytes ShardedCounter[int64, atomic.Int64, *atomic.Int64] InuseObjects ShardedCounter[int64, atomic.Int64, *atomic.Int64] InuseBytes ShardedCounter[int64, atomic.Int64, *atomic.Int64] }
func (*HeapSampleValues) DefaultSampleType ¶ added in v1.2.1
func (h *HeapSampleValues) DefaultSampleType() string
func (*HeapSampleValues) Init ¶ added in v1.2.1
func (h *HeapSampleValues) Init()
func (*HeapSampleValues) SampleTypes ¶ added in v1.2.1
func (h *HeapSampleValues) SampleTypes() []*profile.ValueType
func (*HeapSampleValues) Values ¶ added in v1.2.1
func (h *HeapSampleValues) Values() []int64
type LocationKey ¶ added in v1.2.1
type MetricsAllocator ¶ added in v1.2.1
type MetricsAllocator struct {
// contains filtered or unexported fields
}
func NewMetricsAllocator ¶ added in v1.2.1
func NewMetricsAllocator(upstream Allocator) *MetricsAllocator
func (*MetricsAllocator) Allocate ¶ added in v1.2.1
func (m *MetricsAllocator) Allocate(size uint64, hints Hints) (unsafe.Pointer, Deallocator, error)
type ProfileAllocator ¶ added in v1.2.1
type ProfileAllocator struct {
// contains filtered or unexported fields
}
func NewProfileAllocator ¶ added in v1.2.1
func NewProfileAllocator( upstream Allocator, profiler *Profiler[HeapSampleValues, *HeapSampleValues], fraction uint32, ) *ProfileAllocator
func (*ProfileAllocator) Allocate ¶ added in v1.2.1
func (p *ProfileAllocator) Allocate(size uint64, hints Hints) (unsafe.Pointer, Deallocator, error)
type Profiler ¶ added in v1.2.1
type Profiler[T any, P interface { *T SampleValues }] struct { // contains filtered or unexported fields }
func NewProfiler ¶ added in v1.2.1
func NewProfiler[T any, P interface { *T SampleValues }]() *Profiler[T, P]
type SampleInfo ¶ added in v1.2.1
type SampleValues ¶ added in v1.2.1
type ShardedAllocator ¶ added in v1.2.1
type ShardedAllocator []Allocator
func NewShardedAllocator ¶ added in v1.2.1
func NewShardedAllocator(numShards int, newShard func() Allocator) ShardedAllocator
func (ShardedAllocator) Allocate ¶ added in v1.2.1
func (s ShardedAllocator) Allocate(size uint64, hints Hints) (unsafe.Pointer, Deallocator, error)
type ShardedCounter ¶ added in v1.2.1
type ShardedCounter[T CounterInteger, A any, P interface { *A AtomicInteger[T] }] struct { // contains filtered or unexported fields }
func NewShardedCounter ¶ added in v1.2.1
func NewShardedCounter[T CounterInteger, A any, P interface { *A AtomicInteger[T] }](shards int) *ShardedCounter[T, A, P]
func (*ShardedCounter[T, A, P]) Add ¶ added in v1.2.1
func (s *ShardedCounter[T, A, P]) Add(v T)
func (*ShardedCounter[T, A, P]) Load ¶ added in v1.2.1
func (s *ShardedCounter[T, A, P]) Load() (ret T)
type SizeBoundedAllocator ¶ added in v1.2.1
type SizeBoundedAllocator struct {
// contains filtered or unexported fields
}
func NewSizeBoundedAllocator ¶ added in v1.2.1
func NewSizeBoundedAllocator(upstream Allocator, maxSize uint64, counter *atomic.Uint64) *SizeBoundedAllocator
func (*SizeBoundedAllocator) Allocate ¶ added in v1.2.1
func (s *SizeBoundedAllocator) Allocate(size uint64, hints Hints) (unsafe.Pointer, Deallocator, error)
Source Files ¶
- allocator.go
- c_allocator.go
- chain_deallocator.go
- checked_allocator.go
- class_allocator.go
- config.go
- default.go
- fixed_size_allocator.go
- fixed_size_mmap_allocator.go
- fixed_size_sync_pool_allocator.go
- func_deallocator.go
- hints.go
- metrics_allocator.go
- mmap_linux.go
- profile_allocator.go
- profiler.go
- sharded_allocator.go
- sharded_counter.go
- size_bounded_allocator.go
- stacktrace.go
- unsafe.go
- utils.go
Click to show internal directories.
Click to hide internal directories.