2 Unix SMB/Netbios implementation.
3 Samba temporary memory allocation functions -- torturer
4 Copyright (C) 2001 by Martin Pool <mbp@samba.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 TALLOC_CTX *ctx[NCTX];
31 for (i = 0; i < NCTX; i++) {
32 ctx[i] = talloc_init_named("torture(%d)", i);
35 for (i = 0; i < NCTX; i++) {
37 for (j = 0; j < NOBJ; j++) {
39 size_t size = 1<<(i/3+j);
41 p = talloc(ctx[i], size);
44 "failed to talloc %.0f bytes\n",
49 memset(p, 'A' + j, size);
53 for (i = 0; i < NCTX; i++) {
54 printf("talloc@%p %-40s %dkB\n", ctx[i],
55 talloc_pool_name(ctx[i]),
56 talloc_pool_size(ctx[i]) >> 10);
59 for (i = NCTX - 1; i >= 0; i--)
60 talloc_destroy(ctx[i]);