Limit the amount of deduplication items we store (#1371)

This commit is contained in:
Roy Keene 2018-11-09 15:06:48 -06:00 committed by GitHub
commit 02d65c2266
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2010,6 +2010,17 @@ std::pair<std::unique_ptr<rai::pending_key>, std::unique_ptr<rai::pending_info>>
{
if (deduplication.count (info.source) != 0)
{
/*
* If the deduplication map gets too
* large, clear it out. This may
* result in some duplicates getting
* sent to the client, but we do not
* want to commit too much memory
*/
if (deduplication.size () > 4096)
{
deduplication.clear ();
}
continue;
}