/* Test for special independant_... allocation functions in ptmalloc3. Contributed by Wolfram Gloger , 2006. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include #include "malloc-2.8.3.h" #define CSIZE 104 static int errors = 0; static void merror (const char *msg) { ++errors; printf ("Error: %s\n", msg); } int main (void) { char *p1, **p2, **p3; int i, j; size_t sizes[10] = { 8, 104, 12, 333, 7, 4098, 119, 331, 1, 707 }; printf("---- Start:\n"); malloc_stats(); p1 = malloc (18); if (p1 == NULL) merror ("malloc (10) failed."); p2 = (char **)independent_calloc (25, CSIZE, 0); if (p2 == NULL) merror ("independent_calloc (25, ...) failed."); p3 = (char **)independent_comalloc(10, sizes, 0); if (p3 == NULL) merror ("independent_comalloc (10, ...) failed."); for (i=0; i<25; ++i) { for (j=0; j