… | |
… | |
163 | C<ev_embeddable_backends () & ev_supported_backends ()>, likewise for |
163 | C<ev_embeddable_backends () & ev_supported_backends ()>, likewise for |
164 | recommended ones. |
164 | recommended ones. |
165 | |
165 | |
166 | See the description of C<ev_embed> watchers for more info. |
166 | See the description of C<ev_embed> watchers for more info. |
167 | |
167 | |
168 | =item ev_set_allocator (void *(*cb)(void *ptr, size_t size)) |
168 | =item ev_set_allocator (void *(*cb)(void *ptr, long size)) |
169 | |
169 | |
170 | Sets the allocation function to use (the prototype and semantics are |
170 | Sets the allocation function to use (the prototype is similar - the |
171 | identical to the realloc C function). It is used to allocate and free |
171 | semantics is identical - to the realloc C function). It is used to |
172 | memory (no surprises here). If it returns zero when memory needs to be |
172 | allocate and free memory (no surprises here). If it returns zero when |
173 | allocated, the library might abort or take some potentially destructive |
173 | memory needs to be allocated, the library might abort or take some |
174 | action. The default is your system realloc function. |
174 | potentially destructive action. The default is your system realloc |
|
|
175 | function. |
175 | |
176 | |
176 | You could override this function in high-availability programs to, say, |
177 | You could override this function in high-availability programs to, say, |
177 | free some memory if it cannot allocate memory, to use a special allocator, |
178 | free some memory if it cannot allocate memory, to use a special allocator, |
178 | or even to sleep a while and retry until some memory is available. |
179 | or even to sleep a while and retry until some memory is available. |
179 | |
180 | |