Changeset 288 in vbox for trunk/include/iprt
- Timestamp:
- Jan 25, 2007 5:14:15 AM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 17834
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/heap.h
r283 r288 33 33 /** Pointer to a handle to a simple heap. */ 34 34 typedef RTHEAPSIMPLE *PRTHEAPSIMPLE; 35 36 /** NIL simple heap handle. */ 37 #define NIL_RTHEAPSIMPLE ((RTHEAPSIMPLE)0) 35 38 /* <<< types.h */ 36 39 … … 39 42 /** 40 43 * Initializes the heap. 41 * 44 * 42 45 * @returns IPRT status code on success. 43 46 * @param pHeap Where to store the heap anchor block on success. … … 49 52 /** 50 53 * Merge two simple heaps into one. 51 * 54 * 52 55 * The requiremet is of course that they next two each other memory wise. 53 * 56 * 54 57 * @returns IPRT status code on success. 55 58 * @param pHeap Where to store the handle to the merged heap on success. 56 59 * @param Heap1 Handle to the first heap. 57 60 * @param Heap2 Handle to the second heap. 61 * @remark This API isn't implemented yet. 58 62 */ 59 63 RTDECL(int) RTHeapSimpleMerge(PRTHEAPSIMPLE pHeap, RTHEAPSIMPLE Heap1, RTHEAPSIMPLE Heap2); … … 61 65 /** 62 66 * Allocates memory from the specified simple heap. 63 * 67 * 64 68 * @returns Pointer to the allocated memory block on success. 65 69 * @returns NULL if the request cannot be satisfied. (A VERR_NO_MEMORY condition.) 66 * 70 * 67 71 * @param Heap The heap to allocate the memory on. 68 72 * @param cb The requested heap block size. … … 74 78 /** 75 79 * Allocates zeroed memory from the specified simple heap. 76 * 80 * 77 81 * @returns Pointer to the allocated memory block on success. 78 82 * @returns NULL if the request cannot be satisfied. (A VERR_NO_MEMORY condition.) 79 * 83 * 80 84 * @param Heap The heap to allocate the memory on. 81 85 * @param cb The requested heap block size. … … 86 90 87 91 /** 92 * Reallocates / Allocates / Frees a heap block. 93 * 94 * @param Heap The heap. This is optional and will only be used for strict assertions. 95 * @param pv The heap block returned by RTHeapSimple. If NULL it behaves like RTHeapSimpleAlloc(). 96 * @param cbNew The new size of the heap block. If NULL it behaves like RTHeapSimpleFree(). 97 * @param cbAlignment The requested heap block alignment. Pass 0 for default alignment. 98 * Must be a power of 2. 99 * @remark This API isn't implemented yet. 100 */ 101 RTDECL(void *) RTHeapSimpleRealloc(RTHEAPSIMPLE Heap, void *pv, size_t cbNew, size_t cbAlignment); 102 103 /** 104 * Reallocates / Allocates / Frees a heap block, zeroing any new bits. 105 * 106 * @param Heap The heap. This is optional and will only be used for strict assertions. 107 * @param pv The heap block returned by RTHeapSimple. If NULL it behaves like RTHeapSimpleAllocZ(). 108 * @param cbNew The new size of the heap block. If NULL it behaves like RTHeapSimpleFree(). 109 * @param cbAlignment The requested heap block alignment. Pass 0 for default alignment. 110 * Must be a power of 2. 111 * @remark This API isn't implemented yet. 112 */ 113 RTDECL(void *) RTHeapSimpleReallocZ(RTHEAPSIMPLE Heap, void *pv, size_t cbNew, size_t cbAlignment); 114 115 /** 88 116 * Frees memory allocated from a simple heap. 89 * 117 * 90 118 * @param Heap The heap. This is optional and will only be used for strict assertions. 91 119 * @param pv The heap block returned by RTHeapSimple … … 93 121 RTDECL(void) RTHeapSimpleFree(RTHEAPSIMPLE Heap, void *pv); 94 122 95 #ifdef DEBUG96 123 /** 97 * Dumps the hypervisor heap to the (default) log. 98 * 124 * Gets the size of the specified heap block. 125 * 126 * @returns The actual size of the heap block. 127 * @returns 0 if \a pv is NULL or it doesn't point to a valid heap block. An invalid \a pv 128 * can also cause traps or trigger assertions. 129 * @param Heap The heap. This is optional and will only be used for strict assertions. 130 * @param pv The heap block returned by RTHeapSimple 131 */ 132 RTDECL(size_t) RTHeapSimpleSize(RTHEAPSIMPLE Heap, void *pv); 133 134 /** 135 * Gets the size of the heap. 136 * 137 * This size includes all the internal heap structures. So, even if the heap is 138 * empty the RTHeapSimpleGetFreeSize() will never reach the heap size returned 139 * by this function. 140 * 141 * @returns The heap size. 142 * @returns 0 if heap was safely detected as being bad. 143 * @param Heap The heap. 144 */ 145 RTDECL(size_t) RTHeapSimpleGetHeapSize(RTHEAPSIMPLE Heap); 146 147 /** 148 * Returns the sum of all free heap blocks. 149 * 150 * This is the amount of memory you can theoretically allocate 151 * if you do allocations exactly matching the free blocks. 152 * 153 * @returns The size of the free blocks. 154 * @returns 0 if heap was safely detected as being bad. 155 * @param Heap The heap. 156 */ 157 RTDECL(size_t) RTHeapSimpleGetFreeSize(RTHEAPSIMPLE Heap); 158 159 /** 160 * Printf like callbaclk function for RTHeapSimpleDump. 161 * @param pszFormat IPRT format string. 162 * @param ... Format arguments. 163 */ 164 typedef DECLCALLBACK(void) FNRTHEAPSIMPLEPRINTF(const char *pszFormat, ...); 165 /** Pointer to a FNRTHEAPSIMPLEPRINTF function. */ 166 typedef FNRTHEAPSIMPLEPRINTF *PFNRTHEAPSIMPLEPRINTF; 167 168 /** 169 * Dumps the hypervisor heap. 170 * 99 171 * @param Heap The heap handle. 172 * @param pfnPrintf Printf like function that groks IPRT formatting. 100 173 */ 101 RTDECL(void) RTHeapSimpleDump(RTHEAPSIMPLE Heap); 102 #endif 103 174 RTDECL(void) RTHeapSimpleDump(RTHEAPSIMPLE Heap, PFNRTHEAPSIMPLEPRINTF pfnPrintf); 104 175 105 176 __END_DECLS 106 177 107 #endif 178 #endif 108 179
Note:
See TracChangeset
for help on using the changeset viewer.