Skip to content

Conversation

@jbowes
Copy link

@jbowes jbowes commented Sep 17, 2021

rebuildOrderHeap was allocing a slice with a len of the max required size, then
appending unbound vars to it. This resulted in a slice with nbVars entries of
'0' to start with, followed by the actual unbound vars. Adding those unbound
vars would cause slice growth.

Ultimately, all but the last leading 0 value would be ignored by the queue,
and maybe that shouldn't have been there, as that var might already have been
bound?

Replace the slice alloc len form with the cap form, so there's no leading
'0's, and append doesn't cause slice growth.

rebuildOrderHeap was allocing a slice with a len of the max required size, then
appending unbound vars to it. This resulted in a slice with nbVars entries of
'0' to start with, followed by the actual unbound vars. Adding those unbound
vars would cause slice growth.

Ultimately, all but the last leading `0` value would be ignored by the queue,
and maybe that shouldn't have been there, as that var might already have been
bound?

Replace the slice alloc `len` form with the `cap` form, so there's no leading
'0's, and append doesn't cause slice growth.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant