14
|
1 /**
|
|
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
|
|
3 * Authors: Jacob Carlborg
|
|
4 * Version: Initial created: Aug 3, 2009
|
|
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
|
|
6 */
|
|
7 module dstep.foundation.NSZone;
|
|
8
|
|
9 import dstep.corefoundation.CFBase;
|
|
10 import dstep.foundation.NSObjCRuntime;
|
|
11 import dstep.foundation.NSString;
|
|
12 import dstep.objc.bridge.Bridge;
|
|
13 import dstep.objc.objc : id;
|
|
14
|
|
15 alias _NSZone NSZone;
|
|
16
|
|
17 enum
|
|
18 {
|
|
19 NSScannedOption = (1<<0),
|
|
20 NSCollectorDisabledOption = (1<<1)
|
|
21 }
|
|
22
|
|
23 void NSSetZoneName (NSZone* zone, NSString name)
|
|
24 {
|
|
25 return Bridge.invokeObjcFunction!(void, bindings.NSSetZoneName, NSZone*, NSString)(zone, name);
|
|
26 }
|
|
27
|
|
28 NSString NSZoneName (NSZone* zone)
|
|
29 {
|
|
30 return Bridge.invokeObjcFunction!(NSString, bindings.NSZoneName, NSZone*)(zone);
|
|
31 }
|
|
32
|
|
33 extern (C)
|
|
34 {
|
|
35 NSZone* NSDefaultMallocZone ();
|
|
36 NSZone* NSCreateZone (NSUInteger startSize, NSUInteger granularity, bool canFree);
|
|
37 void NSRecycleZone (NSZone* zone);
|
|
38 NSZone* NSZoneFromPointer (void* ptr);
|
|
39 void* NSZoneMalloc (NSZone* zone, NSUInteger size);
|
|
40 void* NSZoneCalloc (NSZone* zone, NSUInteger numElems, NSUInteger byteSize);
|
|
41 void* NSZoneRealloc (NSZone* zone, void* ptr, NSUInteger size);
|
|
42 void NSZoneFree (NSZone* zone, void* ptr);
|
|
43 void* NSAllocateCollectable (NSUInteger size, NSUInteger options);
|
|
44 void* NSReallocateCollectable (void* ptr, NSUInteger size, NSUInteger options);
|
|
45 NSUInteger NSPageSize ();
|
|
46 NSUInteger NSLogPageSize ();
|
|
47 NSUInteger NSRoundUpToMultipleOfPageSize (NSUInteger bytes);
|
|
48 NSUInteger NSRoundDownToMultipleOfPageSize (NSUInteger bytes);
|
|
49 void* NSAllocateMemoryPages (NSUInteger bytes);
|
|
50 void NSDeallocateMemoryPages (void* ptr, NSUInteger bytes);
|
|
51 void NSCopyMemoryPages (void* source, void* dest, NSUInteger bytes);
|
|
52 NSUInteger NSRealMemoryAvailable ();
|
|
53 } |