Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Resolve memory creep #668

Merged
merged 5 commits into from
Aug 10, 2022
Merged

Resolve memory creep #668

merged 5 commits into from
Aug 10, 2022

Conversation

zivkovicmilos
Copy link
Contributor

@zivkovicmilos zivkovicmilos commented Aug 2, 2022

Description

This PR resolves a steady memory creep that has been noted in the Header.Copy() method.

Screenshot 2022-08-01 at 14 25 45

Screenshot 2022-08-01 at 16 30 58

After the fix:
Screenshot 2022-08-04 at 11 14 07

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

Additional comments

Fixes EDGE-698

@zivkovicmilos zivkovicmilos added the bug fix Functionality that fixes a bug label Aug 2, 2022
@zivkovicmilos zivkovicmilos self-assigned this Aug 2, 2022
@zivkovicmilos zivkovicmilos linked an issue Aug 2, 2022 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Aug 2, 2022

Codecov Report

Merging #668 (1e3ae91) into develop (b5462e0) will decrease coverage by 0.04%.
The diff coverage is 42.02%.

@@             Coverage Diff             @@
##           develop     #668      +/-   ##
===========================================
- Coverage    48.65%   48.61%   -0.05%     
===========================================
  Files          112      112              
  Lines        15364    15378      +14     
===========================================
  Hits          7476     7476              
- Misses        7254     7268      +14     
  Partials       634      634              
Impacted Files Coverage Δ
blockchain/subscription.go 72.00% <ø> (ø)
blockchain/testing.go 59.29% <ø> (ø)
consensus/ibft/consensus.go 0.00% <ø> (ø)
consensus/ibft/consensus_backend.go 0.00% <0.00%> (ø)
consensus/ibft/ibft.go 4.00% <0.00%> (ø)
consensus/ibft/pos.go 0.00% <ø> (ø)
consensus/ibft/sign.go 64.58% <ø> (ø)
consensus/ibft/verifier.go 0.00% <0.00%> (ø)
contracts/staking/query.go 71.42% <ø> (ø)
jsonrpc/errors.go 41.66% <ø> (ø)
... and 24 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@zivkovicmilos zivkovicmilos marked this pull request as ready for review August 4, 2022 15:50
@zivkovicmilos
Copy link
Contributor Author

@Kourin1996

Thank you for the heads up on the code simplification 🙏

Arrays are assignable by value, no need to do deep copy on them since we get that out of the box:
https://goplay.tools/snippet/wbT59SmSb0K

8f37291

Copy link
Contributor

@Kourin1996 Kourin1996 left a comment

Choose a reason for hiding this comment

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

The code looks good.

Copy link
Contributor

@0xAleksaOpacic 0xAleksaOpacic left a comment

Choose a reason for hiding this comment

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

Great catch, thank you for this PR :D
I would maybe only add a unit test that covers Copy method

@zivkovicmilos zivkovicmilos merged commit e14e52a into develop Aug 10, 2022
@zivkovicmilos zivkovicmilos deleted the fix/memory-leak branch August 10, 2022 11:51
@github-actions github-actions bot locked and limited conversation to collaborators Aug 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fix Functionality that fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Steady memory creep
4 participants