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

@gruszczy gruszczy commented Apr 11, 2017

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

This comment has been minimized.

Copy link
Contributor Author

@gruszczy gruszczy commented Apr 11, 2017

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

This comment has been minimized.

Copy link
Member

@odeke-em odeke-em commented Apr 11, 2017

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

This comment has been minimized.

Copy link
Contributor

@rsc rsc commented Apr 11, 2017

Sure, contributions welcome @gruszczy. Thanks.

@josharian

This comment has been minimized.

Copy link
Contributor

@josharian josharian commented Apr 11, 2017

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

@josharian

This comment has been minimized.

Copy link
Contributor

@josharian josharian commented Apr 11, 2017

@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

This comment has been minimized.

Copy link
Contributor

@griesemer griesemer commented Apr 11, 2017

See also #19903, #19931.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Apr 16, 2017

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

@gopherbot gopherbot closed this in f953144 May 2, 2017
@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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.