MCPcopy Create free account
hub / github.com/codechenx/FastTableViewer / estimateRowSize

Method estimateRowSize

buffer.go:160–166  ·  view source on GitHub ↗

estimateRowSize estimates memory usage for a row in bytes

(row []string)

Source from the content-addressed store, hash-verified

158
159// estimateRowSize estimates memory usage for a row in bytes
160func (b *Buffer) estimateRowSize(row []string) int64 {
161 size := int64(len(row) * 8) // Slice overhead (pointers)
162 for _, s := range row {
163 size += int64(len(s)) + stringOverheadBytes
164 }
165 return size
166}
167
168// getMemoryUsage returns current estimated memory usage
169func (b *Buffer) getMemoryUsage() int64 {

Callers 3

contAppendSliMethod · 0.95
BenchmarkMemoryTrackingFunction · 0.80

Calls

no outgoing calls

Tested by 2

BenchmarkMemoryTrackingFunction · 0.64