-
Notifications
You must be signed in to change notification settings - Fork 362
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
VM is not properly released back to sync pool #1033
Milestone
Comments
ajnavarro
added a commit
to ajnavarro/gno
that referenced
this issue
Sep 13, 2023
Properly clean slices using make (the internal logic is expecting slices to not be nil). It closes gnolang#1033 Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
ajnavarro
added a commit
to ajnavarro/gno
that referenced
this issue
Sep 19, 2023
Properly clean slices using make (the internal logic is expecting slices to not be nil). It closes gnolang#1033 Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
moul
added a commit
that referenced
this issue
Sep 22, 2023
Properly clean slices using make (the internal logic is expecting slices to not be nil). It closes #1033 - [X] Added new tests, or not needed, or not feasible - [X] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [X] Updated the official documentation or not needed - [X] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [X] Added references to related issues and PRs - [X] Provided any useful hints for running manual tests - [X] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). --------- Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com> Co-authored-by: Manfred Touron <94029+moul@users.noreply.github.com>
gfanton
pushed a commit
to gfanton/gno
that referenced
this issue
Nov 9, 2023
Properly clean slices using make (the internal logic is expecting slices to not be nil). It closes gnolang#1033 - [X] Added new tests, or not needed, or not feasible - [X] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [X] Updated the official documentation or not needed - [X] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [X] Added references to related issues and PRs - [X] Provided any useful hints for running manual tests - [X] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). --------- Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com> Co-authored-by: Manfred Touron <94029+moul@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Originally posted by @piux2 in #894 (comment)
The opZeroed and valueZeroed arrays are fixed in size with a length of 1024. However, m.Ops and m.Values are slices, and their length could far exceed 1024. The copy() function, in this context, only zeroes out the first 1024 elements of the slice, leaving the remainder unchanged.
Here's a sample code that illustrates this behavior:
https://go.dev/play/p/JoShYG2Q8lf
Given the above, I don't see a significant advantage to zeroing out the entire slice.
A more effective approach might be to set the slice to nil, allowing the Go runtime to garbage collect the underlying arrays.
Here's why:
The VM machine operates within a transactional context, with its lifecycle managed by this context. The efficiency of interactions with gno.land is governed by the time it takes to process requests and responses within this context. The Go runtime handles the allocation and management of underlying slice memory far better than the manual methods we're attempting here.
Furthermore, there's an oversight: only m.Ops and m.Values are being considered for reset. The machine also retains m.Exprs, m.Stmts, m.Blocks, and m.Frames, all of which are slices. It's crucial to release these as well.
The text was updated successfully, but these errors were encountered: