estimateRowSize estimates memory usage for a row in bytes
(row []string)
| 158 | |
| 159 | // estimateRowSize estimates memory usage for a row in bytes |
| 160 | func (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 |
| 169 | func (b *Buffer) getMemoryUsage() int64 { |
no outgoing calls