From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 10 Dec 2019 01:59:42 +0300 From: "Dmitry V. Levin" To: Aleksei Nikiforov Message-ID: <20191209225942.GB15050@altlinux.org> References: <20191209102437.GA6554@altlinux.org> <20191209110300.11607-1-darktemplar@altlinux.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HcAYCG3uE/tztfnV" Content-Disposition: inline In-Reply-To: <20191209110300.11607-1-darktemplar@altlinux.org> Cc: ALT Devel discussion list Subject: Re: [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 22:59:43 -0000 Archived-At: List-Archive: List-Post: --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 09, 2019 at 02:03:00PM +0300, Aleksei Nikiforov wrote: > --- > apt/apt-pkg/contrib/mmap.cc | 15 +++++++++++++++ > apt/doc/apt.conf.5.sgml | 4 ++-- > 2 files changed, 17 insertions(+), 2 deletions(-) >=20 > 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 =3D=3D Pools + PoolCount) > { > + static const bool debug_grow =3D _config->FindB("Debug::DynamicMMa= p::Allocate", false); > + > + if (debug_grow) > + { > + Pool *pool_iter =3D Pools; > + size_t pool_idx =3D 0; > + > + _error->Warning(_("DynamicMMap::Allocate: allocating item of si= ze %lu"), ItemSize); > + > + for (; pool_idx < PoolCount; ++pool_iter, ++pool_idx) > + { > + _error->Warning(_("DynamicMMap::Allocate: Pool %zu, item siz= e: %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 =3D=3D 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. disable the inclusion of statfs data in CDROM IDs. > > - To debug issues related to dynamic memory allocation, an option > - + To debug issues related to dynamic memory allocation, options > + > > =20 Sadly, for some reason most of my comments were ignored. I'm going to apply the following edition of this patch: =46rom a60c3cb4fd06c84c61358af597a88717ecc36c05 Mon Sep 17 00:00:00 2001 =46rom: Aleksei Nikiforov Date: Mon, 9 Dec 2019 14:03:00 +0300 Subject: [PATCH] Add Debug::DynamicMMap::Allocate option Co-developed-by: Dmitry V. Levin --- apt/apt-pkg/contrib/mmap.cc | 17 +++++++++++++++++ apt/doc/apt.conf.5.sgml | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/apt/apt-pkg/contrib/mmap.cc b/apt/apt-pkg/contrib/mmap.cc index 779d7a6..56c3cce 100644 --- a/apt/apt-pkg/contrib/mmap.cc +++ b/apt/apt-pkg/contrib/mmap.cc @@ -266,6 +266,23 @@ std::experimental::optional DynamicMMap::A= llocate(unsigned long Item // No pool is allocated, use an unallocated one if (I =3D=3D Pools + PoolCount) { + static const bool debug_allocate =3D + _config->FindB("Debug::DynamicMMap::Allocate", false); + + if (debug_allocate) + { + _error->Warning(_("DynamicMMap::Allocate: allocating item of size= %lu"), + ItemSize); + + for (unsigned int i =3D 0; i < PoolCount; ++i) + { + _error->Warning(_("DynamicMMap::Allocate: Pool %u, item size: = %lu" + ", start: %lu, count: %lu"), + i, Pools[i].ItemSize, + Pools[i].Start, Pools[i].Count); + } + } + // Woops, we ran out, the calling code should allocate more. if (Empty =3D=3D 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 - =20 --=20 ldv --HcAYCG3uE/tztfnV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJd7tHeAAoJEAVFT+BVnCUIynwP/2E39K/kttSuHnj83YDEQQD9 ehgrVKz21bV3UH/RlyhBjXUMYJr0MC3F8WhFidBKI1VKzp9k+PAJMRx4fshAGtuO bembZckohUZCZaG+y79T9HFlJ8XY3q7R1IBWWOBNyOWgbFeglYSEY91PjamBCPbP SMUv5MtVx7d6txbTxlex5cUru2m7GgTp/hZTnEnoZvIxckAb1qKl5CB6paOltjy3 XUuPfR5TCMPo9dvj6s7O0TiSOchU/09b5Ng9f1Y5oVlz9cN0Ym98EXBzBvbIlGVu 97CRRi5tdL0lcnXhF6/cfG9HZdXGb3VCQT8YBVsALDtE12K0qoTfF5sw3iWvEGIN s9MCdIM8jVOwtKchBoB0pNN0CiaP0gDCDCcv8N4uKirT1js/igeQpqAGq+2dT+Bn bOLgcUAHF7FKnM7wASODdjjMS+xvr7FURXVaVQePD2yR5aySXSqofAediP9JmV7i ZUyZqGhdh7Q3nJpFcH44cbQNAi+jSch83mAYbFX4TZmyNNeulpkPPNsSjCsOHmKB QUXXgXz7tDdIROUPVGwOEXJIAOmhzTU3LC1O/tFUNzf4rP6jyPFwzH1dy5Pl8H6C MQNcjxINqKZj3E/eN6lv+PeYAosiNX+bLC+dSJrKuhUygoPZadvMFKbu3PvH8fWB XS8d5TkAI8zfUtrIZZBh =iTM2 -----END PGP SIGNATURE----- --HcAYCG3uE/tztfnV--