1 2 3 4 5 6 7 8 9 10 11 12
13 14 15
16
17 import xdc.runtime.Error;
18
19 /*!
20 * ======== HeapNull ========
21 * Empty heap
22 */
23 module HeapNull inherits xdc.runtime.IHeap {
24
25 instance:
26
27 /*!
28 * ======== create ========
29 * Create a `HeapNull` heap
30 *
31 * This heap is an always empty heap that is intended to be used by
32 * systems that never allocate objects or free memory but need a heap
33 * to satisfy linkage requirements of third-party libraries.
34 */
35 create();
36
37 /*!
38 * ======== alloc ========
39 * Allocate a block of memory from the heap.
40 *
41 * `HeapNull_alloc()` always fails.
42 */
43 override Ptr alloc(SizeT size, SizeT align, Error.Block *eb);
44
45 /*!
46 * ======== free ========
47 * Free a block of memory back to the heap.
48 *
49 * Calling the `HeapNull_free` function has no effect.
50 */
51 override Void free(Ptr block, SizeT size);
52
53 /*!
54 * ======== isBlocking ========
55 * Can this heap block the caller
56 *
57 * @a(returns)
58 * `HeapNull` always returns `FALSE` since it never blocks on a
59 * resource.
60 */
61 override Bool isBlocking();
62
63 internal:
64 /*!
65 * ======== Instance_State ========
66 */
67 struct Instance_State {
68 };
69 }