Skip to content

Fix a memory leak in header downloader's downloaded #1749

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

Merged
merged 2 commits into from
Aug 30, 2019

Conversation

majecty
Copy link
Contributor

@majecty majecty commented Aug 28, 2019

The header downloader has two queues. The first one is the downloaded
queue, and the second one is the "queued" queue. If a header is
downloaded, downloader enqueues the header to the downloaded
queue. When starting to import the header, the downloader removes the
header from the downloaded queue and enqueues the header to the
"queued" queue. When the importing is done, the downloader removes the
header from the "queued" queue.

However, if a header(let's call it A) is downloaded and is imported
already, A is not removed from the downloaded queue forever. This
commit removes A from the downloaded header.

@majecty majecty requested review from HoOngEe and remagpie August 28, 2019 07:27
remagpie
remagpie previously approved these changes Aug 28, 2019
Copy link
Contributor

@HoOngEe HoOngEe left a comment

Choose a reason for hiding this comment

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

Please add downloaded.shrink_to_fit(); in the below.

The header downloader has two queues. The first one is the downloaded
queue, and the second one is the "queued" queue. If a header is
downloaded, downloader enqueues the header to the downloaded
queue. When starting to import the header, the downloader removes the
header from the downloaded queue and enqueues the header to the
"queued" queue. When the importing is done, the downloader removes the
header from the "queued" queue.

However, if a header(let's call it A) is downloaded and is imported
already, A is not removed from the downloaded queue forever. This
commit removes A from the downloaded header.
@majecty
Copy link
Contributor Author

majecty commented Aug 28, 2019

@HoOngEe I added it.

@HoOngEe HoOngEe self-requested a review August 28, 2019 08:02
@majecty
Copy link
Contributor Author

majecty commented Aug 28, 2019

@remagpie Please approve it!

@majecty majecty added bug Something isn't working sync labels Aug 28, 2019
@majecty majecty merged commit 9775908 into CodeChain-io:master Aug 30, 2019
@majecty majecty deleted the f/memory-leak-downloader branch August 30, 2019 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants