From 02d65c22669e12716a37e7f98815c0c9eb651d8b Mon Sep 17 00:00:00 2001 From: Roy Keene Date: Fri, 9 Nov 2018 15:06:48 -0600 Subject: [PATCH] Limit the amount of deduplication items we store (#1371) --- rai/node/bootstrap.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rai/node/bootstrap.cpp b/rai/node/bootstrap.cpp index b6d6316c..86a82371 100644 --- a/rai/node/bootstrap.cpp +++ b/rai/node/bootstrap.cpp @@ -2010,6 +2010,17 @@ std::pair, std::unique_ptr> { 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; }