Fix sample PQF
[yaz-moved-to-github.git] / util / tstnmem.c
1 /*
2  * Copyright (c) 2002-2003, Index Data
3  * See the file LICENSE for details.
4  *
5  * $Id: tstnmem.c,v 1.1 2003-04-23 20:34:08 adam Exp $
6  */
7
8 #if HAVE_CONFIG_H
9 #include <config.h>
10 #endif
11
12 #include <errno.h>
13 #include <string.h>
14 #include <ctype.h>
15
16 #include <yaz/nmem.h>
17
18 int main (int argc, char **argv)
19 {
20     void *cp;
21     NMEM n;
22     int j;
23
24     nmem_init();
25     n = nmem_create();
26     if (!n)
27         exit (1);
28     for (j = 1; j<500; j++)
29     {
30         cp = nmem_malloc(n, j);
31         if (!cp)
32             exit(2);
33     }
34     
35     for (j = 2000; j<20000; j+= 2000)
36     {
37         cp = nmem_malloc(n, j);
38         if (!cp)
39             exit(3);
40     }
41     nmem_destroy(n);
42     nmem_exit();
43     exit(0);
44 }