]> git.saurik.com Git - apple/libc.git/blame - gen/scalable_malloc.h
Libc-262.tar.gz
[apple/libc.git] / gen / scalable_malloc.h
CommitLineData
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#define SCALABLE_MALLOC_ADD_GUARD_PAGES (1 << 0)
26 // add a guard page before and after each VM region to help debug
27#define SCALABLE_MALLOC_DONT_PROTECT_PRELUDE (1 << 1)
28 // do not protect prelude page
29#define SCALABLE_MALLOC_DONT_PROTECT_POSTLUDE (1 << 2)
30 // do not protect postlude page
31#define SCALABLE_MALLOC_DO_SCRIBBLE (1 << 3)
32 // write 0x55 onto free blocks
33
34extern malloc_zone_t *create_scalable_zone(size_t initial_size, unsigned debug_flags);
35 /* Create a new zone that scales for small objects or large objects */
36
37/***** Private API for debug and performance tools ********/
38
39#define scalable_zone_info_count 9 // maximum number of numbers
40
41extern void scalable_zone_info(malloc_zone_t *zone, unsigned *info, unsigned count);
42 /* Fills info[] with some statistical information:
43 info[0]: number of objects in use
44 info[1]: number of bytes in use
45 ...
46 */
47