From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.1 From: Aleksei Nikiforov To: devel@lists.altlinux.org Date: Mon, 9 Dec 2019 14:03:00 +0300 Message-Id: <20191209110300.11607-1-darktemplar@altlinux.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191209102437.GA6554@altlinux.org> References: <20191209102437.GA6554@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Aleksei Nikiforov Subject: [devel] [PATCH for apt 1/2 v3] Add Debug::DynamicMMap::Allocate option X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 11:04:10 -0000 Archived-At: List-Archive: List-Post: --- apt/apt-pkg/contrib/mmap.cc | 15 +++++++++++++++ apt/doc/apt.conf.5.sgml | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/apt/apt-pkg/contrib/mmap.cc b/apt/apt-pkg/contrib/mmap.cc index a3b06cc..cf01be9 100644 --- a/apt/apt-pkg/contrib/mmap.cc +++ b/apt/apt-pkg/contrib/mmap.cc @@ -265,6 +265,21 @@ std::experimental::optional DynamicMMap::Allocate(unsigned long Item // No pool is allocated, use an unallocated one if (I == Pools + PoolCount) { + static const bool debug_grow = _config->FindB("Debug::DynamicMMap::Allocate", false); + + if (debug_grow) + { + Pool *pool_iter = Pools; + size_t pool_idx = 0; + + _error->Warning(_("DynamicMMap::Allocate: allocating item of size %lu"), ItemSize); + + for (; pool_idx < PoolCount; ++pool_iter, ++pool_idx) + { + _error->Warning(_("DynamicMMap::Allocate: Pool %zu, item size: %lu, start: %lu, count: %lu"), pool_idx, pool_iter->ItemSize, pool_iter->Start, pool_iter->Count); + } + } + // Woops, we ran out, the calling code should allocate more. if (Empty == 0) { diff --git a/apt/doc/apt.conf.5.sgml b/apt/doc/apt.conf.5.sgml index 0a72e45..0026359 100644 --- a/apt/doc/apt.conf.5.sgml +++ b/apt/doc/apt.conf.5.sgml @@ -525,8 +525,8 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";}; command line for each dpkg invokation. - To debug issues related to dynamic memory allocation, an option - -- 2.24.0