]> git.saurik.com Git - apple/libc.git/blame - include/objc/zone.h
Libc-262.2.12.tar.gz
[apple/libc.git] / include / objc / zone.h
CommitLineData
e9ce8d39
A
1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
734aad71 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
e9ce8d39 7 *
734aad71
A
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
e9ce8d39
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
734aad71
A
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
e9ce8d39
A
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25
26#import <objc/malloc.h>
27
28typedef malloc_zone_t NXZone;
29
30#define NX_NOZONE ((NXZone *)0)
31
32/********* Interface to zone based malloc ************/
33
34extern NXZone *NXDefaultMallocZone(void);
35 // Returns the default zone used by the malloc(3) calls
36
37extern NXZone *NXCreateZone(size_t startSize, size_t granularity, int canFree);
38 // Create a new zone with its own memory pool.
39 // canfree: if 0 the allocator will never free memory and mallocing will be fast
40
41extern void NXNameZone(NXZone *z, const char *name);
42 // name a zone; The string will be copied
43
44extern void *NXZoneMalloc(malloc_zone_t *zone, size_t size);
45
46extern void *NXZoneRealloc(malloc_zone_t *zone, void *ptr, size_t size);
47
48extern void *NXZoneCalloc(NXZone *zonep, size_t numElems, size_t byteSize);
49 // Allocates and then clears
50
51extern void NXZoneFree(malloc_zone_t *zone, void *ptr);
52
53extern void NXDestroyZone(malloc_zone_t *zone);
54
55extern NXZone *NXZoneFromPtr(void *ptr);
56 // Returns the zone for a pointer, or NX_NOZONE if not in any zone.
57 // The ptr must have been returned from a malloc or realloc call.
58