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

[Core] Investigate memory leaks, manual GC on ResetToGenesis - (Issue #440) #445

Merged
merged 9 commits into from
Jan 24, 2023

Conversation

deblasis
Copy link
Contributor

Description

This PR reclaims memory manually after the memory-churn intensive operations performed during a ResetToGenesis debug command

In particular:

	// Clear the BlockStore
	if err := m.blockStore.ClearAll(); err != nil {
		return err
	}

	// Clear all the Trees
	if err := postgresCtx.clearAllTreeState(); err != nil {
		return err
	}

This is the result of my initial investigation #440 (comment)

Issue

This might fix #440 but I'd like another pair of eyes on this to understand if this is the right approach

Type of change

Please mark the relevant option(s):

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Major breaking change
  • Documentation
  • Other

List of changes

  • Calling debug.FreeOSMemory() after cleaning up the persistence structures

Testing

  • make develop_test
  • LocalNet w/ all of the steps outlined in the README

Required Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have tested my changes using the available tooling
  • I have updated the corresponding CHANGELOG

If Applicable Checklist

  • I have updated the corresponding README(s); local and/or global
  • I have added tests that prove my fix is effective or that my feature works
  • I have added, or updated, mermaid.js diagrams in the corresponding README(s)
  • I have added, or updated, documentation and mermaid.js diagrams in shared/docs/* if I updated shared/*README(s)

@deblasis deblasis added bug Something isn't working - expected behaviour is incorrect core Core infrastructure - protocol related code health Nice to have code improvement labels Jan 18, 2023
@deblasis deblasis self-assigned this Jan 18, 2023
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.0.0.23] - 2023-01-18

- Consolidate the `Block` proto structures under `shared/core/types`
- Added `debug.FreeOSMemory()` on `ResetToGenesis` to free-up memory and stabilize `LocalNet`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prob need to update this now

@deblasis
Copy link
Contributor Author

@Olshansk PTAL take a look at the short documentation I have added because of the comments in #440

If it's good enough I'll merge 🙏

Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome documentation, ty!

persistence/docs/CHANGELOG.md Outdated Show resolved Hide resolved
@deblasis deblasis merged commit ac169a8 into main Jan 24, 2023
@Olshansk Olshansk deleted the issue/memory-leaks-investigation branch June 2, 2023 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working - expected behaviour is incorrect code health Nice to have code improvement core Core infrastructure - protocol related
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Core] Investigate memory leaks
2 participants