123 |
123 |
124 The function `cxMempoolTransferObject()` transfers a _single_ object managed by the `source` pool to the `dest` pool. |
124 The function `cxMempoolTransferObject()` transfers a _single_ object managed by the `source` pool to the `dest` pool. |
125 In contrast to transferring an entire pool, if `obj` has a reference to `source->allocator`, it must be updated to `dest->allocator` manually. |
125 In contrast to transferring an entire pool, if `obj` has a reference to `source->allocator`, it must be updated to `dest->allocator` manually. |
126 It is also possible to transfer registered memory from one pool to another, this way. |
126 It is also possible to transfer registered memory from one pool to another, this way. |
127 |
127 |
128 The functions returns zero when the transfer was successful and non-zero if a necessary memory allocation was not possible, |
128 The functions return zero when the transfer was successful, and non-zero under one of the following error conditions: |
129 the `source` and `dest` pointers point to the same pool, or the pools have different type (simple, advanced, pure). |
129 - a necessary memory allocation was not possible |
130 In case of an error, no memory is transferred and both pools are in a valid state. |
130 - the `source` and `dest` pointers point to the same pool |
|
131 - the pools have a different type (simple, advanced, pure) |
|
132 - the pools have different base allocators (i.e. `cxDefaultAllocator` changed between creation of the pools) |
|
133 |
|
134 In case of an error, no memory is transferred and both pools remain unchanged and are in a valid state. |
131 |
135 |
132 |
136 |
133 ## Example |
137 ## Example |
134 |
138 |
135 The following code illustrates how the contents of a CSV file are read into pooled memory. |
139 The following code illustrates how the contents of a CSV file are read into pooled memory. |