zone.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
00003  *
00004  * @APPLE_LICENSE_HEADER_START@
00005  * 
00006  * The contents of this file constitute Original Code as defined in and
00007  * are subject to the Apple Public Source License Version 1.1 (the
00008  * "License").  You may not use this file except in compliance with the
00009  * License.  Please obtain a copy of the License at
00010  * http://www.apple.com/publicsource and read it before using this file.
00011  * 
00012  * This Original Code and all software distributed under the License are
00013  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
00014  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
00015  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
00017  * License for the specific language governing rights and limitations
00018  * under the License.
00019  * 
00020  * @APPLE_LICENSE_HEADER_END@
00021  */
00022 
00023 #import <objc/malloc.h>
00024 
00025 typedef malloc_zone_t NXZone;
00026 
00027 #define NX_NOZONE  ((NXZone *)0)
00028 
00029 /*********  Interface to zone based malloc  ************/
00030 
00031 extern NXZone *NXDefaultMallocZone(void);
00032     // Returns the default zone used by the malloc(3) calls
00033 
00034 extern NXZone *NXCreateZone(size_t startSize, size_t granularity, int canFree);
00035     // Create a new zone with its own memory pool.
00036     // canfree: if 0 the allocator will never free memory and mallocing will be fast
00037 
00038 extern void NXNameZone(NXZone *z, const char *name);
00039     // name a zone; The string will be copied
00040 
00041 extern void *NXZoneMalloc(malloc_zone_t *zone, size_t size);
00042 
00043 extern void *NXZoneRealloc(malloc_zone_t *zone, void *ptr, size_t size);
00044 
00045 extern void *NXZoneCalloc(NXZone *zonep, size_t numElems, size_t byteSize);
00046     // Allocates and then clears
00047 
00048 extern void NXZoneFree(malloc_zone_t *zone, void *ptr);
00049 
00050 extern void NXDestroyZone(malloc_zone_t *zone);
00051 
00052 extern NXZone *NXZoneFromPtr(void *ptr);
00053     // Returns the zone for a pointer, or NX_NOZONE if not in any zone.
00054     // The ptr must have been returned from a malloc or realloc call.
00055 

Generated on Tue Sep 19 21:18:36 2006 for Boomerang by  doxygen 1.4.6