From 0e48c075bce7d60693c5324dab175a650d477f0a Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Wed, 19 Jan 2011 12:50:11 +0100 Subject: [PATCH] Fix excessive memory usage. Use Page_breaking::system_count, not Page_spacing_result::system_count. The latter counts both titles and non-title systems, which leads to huge memory usage in Page_breaking::line_divisions_rec. --- lily/optimal-page-breaking.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lily/optimal-page-breaking.cc b/lily/optimal-page-breaking.cc index 9cac3efa3d..455aad3274 100644 --- a/lily/optimal-page-breaking.cc +++ b/lily/optimal-page-breaking.cc @@ -52,6 +52,10 @@ Optimal_page_breaking::solve () Line_division ideal_line_division = current_configuration (0); Line_division best_division = ideal_line_division; vsize min_sys_count = 1; + + // Note that Page_breaking only counts non-title systems in + // system_count (whereas Page_spacing_result::system_count counts + // titles and non-titles). vsize ideal_sys_count = system_count (); if (!scm_is_integer (forced_page_count)) @@ -62,7 +66,6 @@ Optimal_page_breaking::solve () best = space_systems_on_best_pages (0, first_page_num); page_count = best.systems_per_page_.size (); - ideal_sys_count = best.system_count (); min_sys_count = ideal_sys_count - best.systems_per_page_.back (); if (page_count > 1 && best.systems_per_page_[page_count - 2] > 1) @@ -82,7 +85,7 @@ Optimal_page_breaking::solve () || ideal_sys_count < min_system_count (0, end)) { warning (_ ("could not satisfy systems-per-page and page-count at the same time, ignoring systems-per-page")); - ideal_sys_count = best.system_count (); + ideal_sys_count = system_count (); min_sys_count = page_count; } else -- 2.39.2