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

runtime: makemap should treat the size parameter as a hint and not panic if it's too big #19926

Closed
gruszczy opened this issue Apr 11, 2017 · 7 comments
Milestone

Comments

@gruszczy
Copy link
Contributor

This came up during work on https://go-review.googlesource.com/c/40113/. Currently when the hashmap receives a size hint it can't use (for example because it's too big), it panics. Instead, it should treat purely as a hint about the required size and adjust it to what is possible.

@gruszczy
Copy link
Contributor Author

I would be happy to make the changes too.

@odeke-em odeke-em changed the title Hashmap should treat the size parameter as a hint and not panic if it's too big runtime: makemap should treat the size parameter as a hint and not panic if it's too big Apr 11, 2017
@odeke-em
Copy link
Member

/cc @randall77 @josharian

@rsc rsc added this to the Go1.9 milestone Apr 11, 2017
@rsc
Copy link
Contributor

rsc commented Apr 11, 2017

Sure, contributions welcome @gruszczy. Thanks.

@josharian
Copy link
Contributor

SGTM. Please add khr and josharian as reviewers on the CL.

@josharian
Copy link
Contributor

@gruszczy also, feel free to ask implementation questions here if you need any pointers. If you haven't already discovered this, you'll want to look at runtime/hashmap.go, func makemap, pretty near the beginning of the function.

@griesemer
Copy link
Contributor

griesemer commented Apr 11, 2017

See also #19903, #19931.

@gopherbot
Copy link

CL https://golang.org/cl/40854 mentions this issue.

@golang golang locked and limited conversation to collaborators May 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants