From nobody Wed Oct 20 06:10:37 2021 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3B79717FF379 for ; Wed, 20 Oct 2021 06:10:37 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZ0bK1B0nz4hrw for ; Wed, 20 Oct 2021 06:10:37 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE785225A4 for ; Wed, 20 Oct 2021 06:10:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 19K6AaBC081767 for ; Wed, 20 Oct 2021 06:10:36 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 19K6Aa54081766 for bugs@FreeBSD.org; Wed, 20 Oct 2021 06:10:36 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 259294] [libc] add a freeres function Date: Wed, 20 Oct 2021 06:10:37 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: pjfloyd@wanadoo.fr X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259294 Bug ID: 259294 Summary: [libc] add a freeres function Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: pjfloyd@wanadoo.fr Summary ~~~~~~~ This is a request to add a freeres function to libc. Motivation ~~~~~~~~~~ This function would be used by Valgrind (and conceivably other similar tool= s). The purpose is to free any "still reachable" memory on a clean exit. For instance, this would include buffers allocated for I/O. The freeres function doesn't get called by libc and in fact never gets call= ed for applications running in a regular environment. However, Valgrind will l= ook to see if it is present and call it (unless a command line flag has been specified not to do so). Current Status ~~~~~~~~~~~~~~ On Linux, GNU libc has such a function (as does libstdc++,__gnu_cxx::__fre= eres ). On FreeBSD, libc++ does not allocate any buffers whose lifetime is not mana= ged by the runtime. The libstdc++ function __gnu_cxx::__freeres is used in the = same way as it is on Linux. For FreeBSD libc, the default suppression mechanism is used. Whilst this is= a reasonable solution, some users seem to find it disturbing and want to see strictly zero leaks/memory use in the final summary. This means that a 'printf("Hell, World!\n");' C application will have the following summary from Valgring memcheck of FreeBSD =3D=3D76307=3D=3D HEAP SUMMARY: =3D=3D76307=3D=3D in use at exit: 4,096 bytes in 1 blocks =3D=3D76307=3D=3D total heap usage: 1 allocs, 0 frees, 4,096 bytes alloca= ted =3D=3D76307=3D=3D=20 =3D=3D76307=3D=3D LEAK SUMMARY: =3D=3D76307=3D=3D definitely lost: 0 bytes in 0 blocks =3D=3D76307=3D=3D indirectly lost: 0 bytes in 0 blocks =3D=3D76307=3D=3D possibly lost: 0 bytes in 0 blocks =3D=3D76307=3D=3D still reachable: 0 bytes in 0 blocks =3D=3D76307=3D=3D suppressed: 4,096 bytes in 1 blocks On Linux, the "in use at exit" is 0 and there is no "suppressed" line at the end. --=20 You are receiving this mail because: You are the assignee for the bug.=