You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now I'm suspecting this comes from "not shrinking" the Downloaded like data implemented in HeaderDownloader and BodyDownloader. I checked that length of queued (see #1567, data of which was previously included in downloaded) reaches up to about 900,000.
That had not shrunk and will be alive continuously, I think the HashMap occupied huge amount of memory.
HashMap has shrink_to_fit method, But I'm worrying about the reallocation overhead. @foriequal0 showed me that the reallocation step occurs sparsely with doubling the previous size when inserting to HashMap but occurs densely when shrinking the HashMap.
Hi @HoOngEe,
Please call shirink_to_fit after removing items.
I don't think it becomes a burden to reallocate because HashMap allocates memory more than it needs when there is no capacity.
And please apply this change to HashSet and Vec in BodyDownloader.
Activity
seonpyoKim commentedon May 29, 2019
Now I'm suspecting this comes from "not shrinking" the
Downloadedlike data implemented inHeaderDownloaderandBodyDownloader. I checked that length ofqueued(see #1567, data of which was previously included indownloaded) reaches up to about 900,000.That had not shrunk and will be alive continuously, I think the HashMap occupied huge amount of memory.
seonpyoKim commentedon May 29, 2019
HashMaphasshrink_to_fitmethod, But I'm worrying about the reallocation overhead.@foriequal0 showed me that the reallocation step occurs sparsely with doubling the previous size when inserting to
HashMapbut occurs densely when shrinking theHashMap.sgkim126 commentedon May 30, 2019
Hi @HoOngEe,
Please call
shirink_to_fitafter removing items.I don't think it becomes a burden to reallocate because
HashMapallocates memory more than it needs when there is no capacity.And please apply this change to
HashSetandVecin BodyDownloader.seonpyoKim commentedon Aug 28, 2019
Here is the main reason of high memory. #1585 (comment)