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