From cf67fcbd0628e03ac2f788da6f2c082121faf21f Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 12 Mar 2012 05:47:32 -0500 Subject: Resolved a huge performance issue with 'pricedb' --- src/report.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/report.cc') diff --git a/src/report.cc b/src/report.cc index 1adbe9d0..c4f916d7 100644 --- a/src/report.cc +++ b/src/report.cc @@ -469,8 +469,20 @@ void report_t::commodities_report(post_handler_ptr handler) { handler = chain_handlers(handler, *this); - posts_commodities_iterator walker(*session.journal.get()); - pass_down_posts(handler, walker); + posts_commodities_iterator * walker(new posts_commodities_iterator(*session.journal.get())); + try { + pass_down_posts(handler, *walker); + } + catch (...) { +#if defined(VERIFY_ON) + IF_VERIFY() { + // If --verify was used, clean up the posts_commodities_iterator. + // Otherwise, just leak like a sieve. + checked_delete(walker); + } +#endif + throw; + } session.journal->clear_xdata(); } -- cgit v1.2.3