Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(allocator): increase number of buffers from 32 to 64 in allocator #234

Merged
merged 1 commit into from
Dec 2, 2020

Conversation

NamanJain8
Copy link
Contributor

@NamanJain8 NamanJain8 commented Dec 2, 2020

This PR increases the number of buffers from 32 to 64 in z.Allocator.
Related discuss issue: https://discuss.dgraph.io/t/panic-allocator-can-not-allocate-more-than-32-buffers/11650
The following test crashes even at ~13GB allocator size.

func TestAllocatorIdx(t *testing.T) {
	a := NewAllocator(512)
	sz := 512
	defer a.Release()
	for i := 0; i < 40; i++ {
		x := a.Allocate(sz)
                // mimic how allocator allocates
		if sz < 1<<30 {
			sz = 2 * sz
		}
		rand.Read(x)
		fmt.Printf("%s\n", a)
	}
}

Failure message

idx: 29 len: 1073741824 cum: 10737417728
idx: 30 len: 1073741824 cum: 11811159552
idx: 31 len: 1073741824 cum: 12884901376
bi: 31 pi: 1073741824
Size: 12884901376

--- FAIL: TestAllocatorIdx (10.40s)
panic: Allocator can not allocate more than 32 buffers [recovered]
	panic: Allocator can not allocate more than 32 buffers

This change is Reviewable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants