From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C09F2391C358; Thu, 8 Dec 2022 14:10:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C09F2391C358 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670508639; bh=MFxV0dK2TO98DaKtUJ2Biste4+WaxJi2P46jkwfnBxo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ThADrKFim42uBoINMxqrg4ja+1fI2FbFcG0RyHsgD3DhQKjCM7b/eueUHE3Qjt7vy 2Mq09m3PhwZ/CnWKclqTX/XiCbZ/cJHmJeG4hZ6QGezZNiCjWKAqZHMF16ySMEmrXL l8iwdevYbhTLqRoTqADjKUNzicjWYR72WyrBMj8M= From: "nsz at gcc dot gnu.org" To: glibc-bugs@sourceware.org Subject: [Bug malloc/14581] memalign allocations are often not reused after free Date: Thu, 08 Dec 2022 14:10:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: malloc X-Bugzilla-Version: 2.15 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: nsz at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: carlos at redhat dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: security- X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D14581 Szabolcs Nagy changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nsz at gcc dot gnu.org --- Comment #20 from Szabolcs Nagy --- i think i ran into this or a similar issue, but the proposed patch "[v4,1/1] memalign: Support scanning for aligned chunks." does not seem to help. example: 100 iterations where each iteration leaks 16+64 bytes, everything = else is freed, but every iteration seems to increase the heap by 3231744 bytes at least. with GLIBC_TUNABLES=3Dglibc.malloc.mmap_threshold=3D600000 there is = no issue (large allocations turn into mmap/munmap pairs). #include #include static void *volatile q; static void use(void *p){ q =3D p; } int main(int argc, char *argv[]) { void *p1; void *p2; void *p3; for (int i=3D0; i < 100; i++) { p1 =3D aligned_alloc(512, 1176064); memset(p1, 0, 1176064); p2 =3D malloc(16); p3 =3D malloc(64); use(p1); use(p2); use(p3); free(p1); p1 =3D aligned_alloc(256, 646656); p2 =3D aligned_alloc(1024, 3232768); memset(p2, 0, 3232768); p3 =3D malloc(128); use(p1); use(p2); use(p3); free(p2); free(p3); free(p1); } } --=20 You are receiving this mail because: You are on the CC list for the bug.=