Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Oct 2021 06:07:23 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 259294] [libc] add a freeres function
Message-ID:  <bug-259294-227-piwYu7FkGl@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-259294-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-259294-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259294

--- Comment #1 from Paul Floyd <pjfloyd@wanadoo.fr> ---
I'll see if I can work out a patch.

In the meantime, here is the canonical C example

#include <stdio.h>

int main(void)
{
   printf("Hellw, World!\n");
}

If I run

 valgrind --default-suppressions=3Dno --leak-check=3Dfull --show-reachable=
=3Dyes
./hello_world

then I get


=3D=3D1497=3D=3D 4,096 bytes in 1 blocks are still reachable in loss record=
 1 of 1
=3D=3D1497=3D=3D    at 0x484C8A4: malloc (in
/usr/local/libexec/valgrind/vgpreload_memcheck-amd64-freebsd.so)
=3D=3D1497=3D=3D    by 0x4974AA3: ??? (in /lib/libc.so.7)
=3D=3D1497=3D=3D    by 0x4987278: ??? (in /lib/libc.so.7)
=3D=3D1497=3D=3D    by 0x497B012: ??? (in /lib/libc.so.7)
=3D=3D1497=3D=3D    by 0x497AD89: vfprintf_l (in /lib/libc.so.7)
=3D=3D1497=3D=3D    by 0x4975AF3: printf (in /lib/libc.so.7)
=3D=3D1497=3D=3D    by 0x2018A8: main (hello_world.c:5)

And for C++ the canonical hello world

#include <iostream>

int main()
{
   std::cout << "Hello, World!\n";
}


valgrind --default-suppressions=3Dno --leak-check=3Dfull --show-reachable=
=3Dyes
./hello_world2

=3D=3D1507=3D=3D 4,096 bytes in 1 blocks are still reachable in loss record=
 1 of 1
=3D=3D1507=3D=3D    at 0x484C8A4: malloc (in
/usr/local/libexec/valgrind/vgpreload_memcheck-amd64-freebsd.so)
=3D=3D1507=3D=3D    by 0x4AB5AA3: ??? (in /lib/libc.so.7)
=3D=3D1507=3D=3D    by 0x4AC8278: ??? (in /lib/libc.so.7)
=3D=3D1507=3D=3D    by 0x4AB47D2: ??? (in /lib/libc.so.7)
=3D=3D1507=3D=3D    by 0x4AB50A3: fwrite (in /lib/libc.so.7)
=3D=3D1507=3D=3D    by 0x202C08: std::__1::basic_streambuf<char,
std::__1::char_traits<char> >::sputn(char const*, long)
(include/c++/v1/streambuf:229)
=3D=3D1507=3D=3D    by 0x202A1F: std::__1::ostreambuf_iterator<char,
std::__1::char_traits<char> > std::__1::__pad_and_output<char,
std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char,
std::__1::char_traits<char> >, char const*, char const*, char const*,
std::__1::ios_base&, char) (include/c++/v1/locale:1411)
=3D=3D1507=3D=3D    by 0x202725: std::__1::basic_ostream<char,
std::__1::char_traits<char> >& std::__1::__put_character_sequence<char,
std::__1::char_traits<char> >(std::__1::basic_ostream<char,
std::__1::char_traits<char> >&, char const*, unsigned long)
(include/c++/v1/ostream:730)
=3D=3D1507=3D=3D    by 0x20260B: std::__1::basic_ostream<char,
std::__1::char_traits<char> >& std::__1::operator<<
<std::__1::char_traits<char> >(std::__1::basic_ostream<char,
std::__1::char_traits<char> >&, char const*) (include/c++/v1/ostream:869)


While looking at this, it strikes me that I'm not reading the libc debuginf=
o. I
need to investigate that.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-259294-227-piwYu7FkGl>