[Ur] missunderstanding - or serious memory handling issue?
Marc Weber
marco-oweber at gmx.de
Tue Dec 7 20:10:26 EST 2010
uw_mallac:
You try realloc and if the new pointer is a different one you fail -
causing all callback functions to be called maybe accessing memory
which may have been overridden by other threads because realloc allowed
it to be reused.
So if uw_malloc returns memory blocks which you can reuse in those
handlers than its a bug.
static void buf_check_ctx(uw_context ctx, const char *kind, buf *b, size_t extra, const char *desc) {
if (b->back - b->front < extra) {
// ....
}
// ..
if (new_heap != b->start) {
b->start = new_heap;
uw_error(ctx, UNLIMITED_RETRY, "Couldn't allocate new %s contiguously", desc);
}
Marc Weber
More information about the Ur
mailing list