2 * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
10 #pragma ident "%Z%%M% %I% %E% SMI"
13 SM_IDSTR(id
, "@(#)$Id: t-rpool.c,v 1.16 2001/03/04 18:38:47 ca Exp $")
29 (void) sm_io_fprintf(smioout
, SM_TIME_DEFAULT
, "rfree freeing `%s'\n",
41 SM_RPOOL_ATTACH_T att
;
43 sm_test_begin(argc
, argv
, "test rpool");
44 sm_debug_addsetting_x("sm_check_heap", 1);
45 rpool
= sm_rpool_new_x(NULL
);
46 SM_TEST(rpool
!= NULL
);
47 att
= sm_rpool_attach_x(rpool
, rfree
, "attachment #1");
49 for (i
= 0; i
< 26; ++i
)
51 size_t sz
= i
* i
* i
;
53 a
[i
] = sm_rpool_malloc_x(rpool
, sz
);
54 for (j
= 0; j
< sz
; ++j
)
57 att
= sm_rpool_attach_x(rpool
, rfree
, "attachment #2");
58 (void) sm_rpool_attach_x(rpool
, rfree
, "attachment #3");
63 sm_dprintf("heap after filling up rpool:\n");
64 sm_heap_report(smioout
, 3);
65 sm_dprintf("freeing rpool:\n");
67 sm_dprintf("heap after freeing rpool:\n");
68 sm_heap_report(smioout
, 3);