Skip to content

Commit

Permalink
fix: support 32bit builds (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroshade authored Apr 30, 2024
1 parent ad836ba commit 5dde47b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 0 additions & 3 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import (

const (
defaultMaxByteSliceSize = 1_048_576 // 1 MiB
// Max allocation size for an array due to the limit in number of bits in a heap address:
// https://github.com/golang/go/blob/7f76c00fc5678fa782708ba8fece63750cb89d03/src/runtime/malloc.go#L183
maxAllocSize = int(1 << 48)
)

// DefaultConfig is the default API.
Expand Down
8 changes: 8 additions & 0 deletions config_386.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package avro

import "math"

// Max allocation size for an array due to the limit in number of bits in a heap address:
// https://github.com/golang/go/blob/7f76c00fc5678fa782708ba8fece63750cb89d03/src/runtime/malloc.go#L190
// 32-bit systems accept the full 32bit address space
const maxAllocSize = math.MaxInt
7 changes: 7 additions & 0 deletions config_x64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build !386

package avro

// Max allocation size for an array due to the limit in number of bits in a heap address:
// https://github.com/golang/go/blob/7f76c00fc5678fa782708ba8fece63750cb89d03/src/runtime/malloc.go#L183
const maxAllocSize = int(1 << 48)

0 comments on commit 5dde47b

Please sign in to comment.