Skip to content

Commit

Permalink
Merge #2819: [Core] Solve BLS Memleak
Browse files Browse the repository at this point in the history
a7c6fac Solve BLS Memleak if object not pushed to queue (Liquid)

Pull request description:

  Partial backport of dashpay#5202

  In term of trying to keep memory down, this is a potential bug where if the object was never entered into the queue it just starts to bloat the memory.

ACKs for top commit:
  panleone:
    utACK a7c6fac
  Fuzzbawls:
    utACK a7c6fac

Tree-SHA512: cb375c16bdad455a95ae906dfadefc28647adee69ae0237bbe2b7b38f3b0f980afd483f4c0c5316b53033fd5dd4fc77b74497debff30ca00c7cc48987687e30a
  • Loading branch information
Fuzzbawls committed Apr 7, 2023
2 parents 6e50e49 + a7c6fac commit a33988b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/bls/bls_worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,13 @@ struct Aggregator : public std::enable_shared_from_this<Aggregator<T>> {

void PushAggQueue(const T& v)
{
aggQueue.push(new T(v));
auto copyT = new T(v);
try {
aggQueue.push(copyT);
} catch (...) {
delete copyT;
throw;
}

if (++aggQueueSize >= batchSize) {
// we've collected enough intermediate results to form a new batch.
Expand Down

0 comments on commit a33988b

Please sign in to comment.