You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
841 B

name: duk_free
proto: |
void duk_free(duk_context *ctx, void *ptr);
summary: |
<p>Like <code><a href="#duk_free_raw">duk_free_raw()</a></code> but may involve
garbage collection steps. The garbage collection interaction cannot cause
the operation to fail.</p>
<p><code>duk_free()</code> can be used to free memory allocated with either
<code><a href="#duk_alloc">duk_alloc()</a></code> or
<code><a href="#duk_alloc_raw">duk_alloc_raw()</a></code>
and their reallocation variants.</p>
<div class="note">
Currently a <code>duk_free()</code> cannot cause a garbage collection
pass but does update internal GC trigger counters.
</div>
example: |
void *buf = duk_alloc(ctx, 1024);
/* ... */
duk_free(ctx, buf); /* safe even if 'buf' is NULL */
tags:
- memory
seealso:
- duk_free_raw
introduced: 1.0.0