root/trunk/umem_test3.c

Revision 45, 501 bytes (checked in by wez, 7 years ago)

fixup malloc replacement on 64-bit systems; was missing a configure check.

  • Property svn:eol-style set to native
Line 
1 #include "config.h"
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5
6 #if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
7 #include <malloc.h>
8 #endif
9
10 static void minfo(void)
11 {
12 #if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
13   struct mallinfo mi;
14   mi = mallinfo();
15   printf(" fordblks = %d\n", mi.fordblks);
16   malloc_stats();
17   printf("\n");
18 #endif
19 }
20
21 int
22 main (void)
23 {
24   char *p;
25
26   minfo();
27   p = malloc(10);
28   free(p);
29   minfo();
30
31   return EXIT_SUCCESS;
32 }
33
34 /* vim:ts=2:sw=2:et:
35  */
Note: See TracBrowser for help on using the browser.