From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 383F63858C62; Tue, 11 Jul 2023 12:15:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 383F63858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689077740; bh=ZsyaCpYNrbSLPY4ayGVGMEgKEaXk8iY+AXuXOAy/qcA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PVEZo45rVJhSSz6xTHwQY2O2WqlmAZ6hUh9xS+924DRQ1t0sX4CBJam1eE7zz6/kR Ftcx8/a4xzHeyto5sSsY8Adte/KDzZU15QvQliTXQMSAcnVycsxHzrw4N2XOdwdQk7 rPfc1/a1GBkR9shU75OplrO7QM2k6HByrJlR1k/k= From: "fweimer at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug malloc/30625] Moving "free(buf)" slows down code x1.6 Date: Tue, 11 Jul 2023 12:15:39 +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.36 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fweimer at redhat dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: security- X-Bugzilla-Changed-Fields: 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=3D30625 --- Comment #3 from Florian Weimer --- (In reply to Askar Safin from comment #2) > Please, return memory to OS only if 2 following conditions hold in the sa= me > time: > - Allocated memory is significantly smaller than latest peak I think this is true in both cases in the reproducer? Doesn't the memory d= rop by one third of the peak heap size (twice)? > - Enough time passed from latest peak That can cause a lot of memory be left behind if the program goes to sleep,= as I tried to explain. In a multi-threaded program, we could perhaps reclaim t= he memory from a service thread, but in a single-threaded program this isn't possible. --=20 You are receiving this mail because: You are on the CC list for the bug.=