=proto void *duk_realloc(duk_context *ctx, void *ptr, size_t size); =summary

Like duk_realloc_raw() but may trigger a garbage collection to satisfy the request. However, the allocated memory itself is not automatically garbage collected.

Memory reallocated with duk_realloc() can be freed with either duk_free() or duk_free_raw().

=example void *buf = duk_alloc(ctx, 1024); if (buf) { void *buf2 = duk_realloc(ctx, 2048); if (!buf2) { printf("failed to reallocate, 'buf' still valid\n"); } else { printf("reallocate successful, 'buf2' now valid\n"); } } =tags memory =seealso duk_realloc_raw