72 The transferred allocator will be destroyed when the `dest` pool gets destroyed. |
72 The transferred allocator will be destroyed when the `dest` pool gets destroyed. |
73 |
73 |
74 The function returns zero when the transfer was successful and non-zero if a necessary memory allocation was not possible, |
74 The function returns zero when the transfer was successful and non-zero if a necessary memory allocation was not possible, |
75 or the `source` and `dest` pointers point to the same pool. |
75 or the `source` and `dest` pointers point to the same pool. |
76 In case of an error, no memory is transferred and both pools are in a valid state. |
76 In case of an error, no memory is transferred and both pools are in a valid state. |
77 |
|
78 > Although the allocator from the `source` pool remains valid for the already allocated objects, |
|
79 > it is **not** valid to use that allocator to allocate new objects in the `dest` pool. |
|
80 > It may only be used to free or reallocate the memory of the existing objects. |
|
81 > |
|
82 > The reason is, that the allocator will be destroyed after destroying all objects from the `source` pool and |
|
83 > _before_ destroying objects in the `dest` pool which were allocated after the transfer. |
|
84 >{style="warning"} |
|
85 |
77 |
86 |
78 |
87 ## Example |
79 ## Example |
88 |
80 |
89 The following code illustrates how the contents of a CSV file are read into pooled memory. |
81 The following code illustrates how the contents of a CSV file are read into pooled memory. |