This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
PATCH (not worthy of gcc-patches): Add memory report for __FreeBSD__
- From: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Fri, 8 Aug 2003 02:59:03 -0500 (CDT)
- Subject: PATCH (not worthy of gcc-patches): Add memory report for __FreeBSD__
- Reply-to: rittle at labs dot mot dot com
Reworked patch in my tree for long while to limit damage and committed
it to mainline. I think this should be safe on a random POSIX machine
but I must leave it to another to promote it to more platforms after
at least a spot check. - Loren
(This implementation was produced after looking at this line of
<malloc.h>: 'int uordblks; /* total allocated space */'. I had no
idea what units that was in but 1K seemed reasonable.)
* testsuite/testsuite_performance.h (__FreeBSD__): Add fake mallinfo.
Index: libstdc++-v3/testsuite/testsuite_performance.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/testsuite_performance.h,v
retrieving revision 1.7
diff -c -r1.7 testsuite_performance.h
*** libstdc++-v3/testsuite/testsuite_performance.h 24 Jul 2003 21:07:29 -0000 1.7
--- libstdc++-v3/testsuite/testsuite_performance.h 8 Aug 2003 07:28:27 -0000
***************
*** 40,45 ****
--- 40,52 ----
#ifdef __linux__
#include <malloc.h>
+ #elif defined (__FreeBSD__)
+ extern "C"
+ {
+ struct mallinfo { int uordblks; };
+ struct mallinfo mallinfo(void)
+ { struct mallinfo m = { (((size_t) sbrk (0) + 1023) / 1024) }; return m; }
+ }
#else
extern "C"
{