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

feat: (gnovm): garbage collection #3458

Open
wants to merge 43 commits into
base: master
Choose a base branch
from

Conversation

ltzmaxwell
Copy link
Contributor

@ltzmaxwell ltzmaxwell commented Jan 8, 2025

address: #266 .

When the allocator runs out of memory, it reports “allocation limit exceeded.” At this point, the garbage collector (GC) scans blocks and frames to identify objects that are still reachable from the machine. It then recalculates the memory they consume and resets the allocator accordingly.

When a block is popped or set to nil, all objects defined and allocated within it become unreachable and are no longer counted toward the allocation limit.

A simple gas consumption logic is implemented by counting the number of GC cycles, specifically tracking how many times Allocate is invoked. However, I believe a more precise approach should be determined through benchmarking, which can be expanded after.

@github-actions github-actions bot added 📦 🤖 gnovm Issues or PRs gnovm related 📦 ⛰️ gno.land Issues or PRs gno.land package related labels Jan 8, 2025
@ltzmaxwell ltzmaxwell marked this pull request as draft January 8, 2025 09:19
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Jan 8, 2025

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 The pull request was created from a fork (head branch repo: ltzmaxwell/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

@Kouteki Kouteki added this to the 🚀 Mainnet beta launch milestone Feb 3, 2025
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Feb 3, 2025
Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 78.52761% with 70 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
gnovm/pkg/gnolang/gonative.go 21.87% 21 Missing and 4 partials ⚠️
gnovm/pkg/gnolang/alloc.go 86.23% 14 Missing and 5 partials ⚠️
gnovm/pkg/gnolang/values.go 70.31% 17 Missing and 2 partials ⚠️
gnovm/pkg/gnolang/uverse.go 71.42% 6 Missing ⚠️
gnovm/pkg/gnolang/realm.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions github-actions bot added the 📦 🌐 tendermint v2 Issues or PRs tm2 related label Feb 9, 2025
@ltzmaxwell ltzmaxwell changed the title WIP feat: (gnovm): gc feat: (gnovm): garbage collection Feb 9, 2025
@ltzmaxwell ltzmaxwell closed this Feb 9, 2025
@ltzmaxwell ltzmaxwell reopened this Feb 9, 2025
@ltzmaxwell ltzmaxwell marked this pull request as ready for review February 9, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related 🧾 package/realm Tag used for new Realms or Packages.
Projects
Development

Successfully merging this pull request may close these issues.

3 participants