---
name: "rlist_free"
section: "3"
platform: "linux"
package: "libroy-dev"
version: "1.0.8-1"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/rlist_free"
---

# rlist\_free(3)

free a dynamicly allocated rlist

## NAME

rlist\_free - free a dynamicly allocated rlist

## SYNOPSIS

\#include \<roy.h\>

void rlist\_free (RList \* *list*);

## DESCRIPTION

Free the dynamic rlist *list* that was allocated using [*rlist\_new*(3)](/rlist_new/3.md). This will NOT free the items of the *list*. You should use RLIST\_FOREACH to visit each entry, [*rlist\_remove*(3)](/rlist_remove/3.md) to unlink each entry, and a call to your entry destructor to free the item's memory before calling [*rlist\_free*(3)](/rlist_free/3.md).

If *list* wasn't dynamicly allocated using [*rlist\_new*(3)](/rlist_new/3.md) then it should be destroyed using the RLIST\_DESTRUCT macro, see [*rlist*(3)](/rlist/3.md).

- EXAMPLE

  This is the proper way to destory the full rlist.

```
        RLIST_FOREACH (list, entry) {
                rlist_remove (entry);
                rmem_free (entry);      /* Opposite of rmem_new(3). */
        } RFOREACH_CLOSE;
```

```
        rlist_free (list);              /* Do this last. */
```

## RETURN VALUE

This call doesn't return any value.

## ERRORS

A call to [*rlist\_free*(3)](/rlist_free/3.md) will never fail.

## MACRO

The [*rlist\_free*(3)](/rlist_free/3.md) api is implemented using a macro.

## SEE ALSO

[*rlist*(3)](/rlist/3.md), [*rlist\_append*(3)](/rlist_append/3.md),  [*rlist\_compare*(3)](/rlist_compare/3.md), [*rlist\_first*(3)](/rlist_first/3.md),  [*rlist\_last*(3)](/rlist_last/3.md), [*rlist\_new*(3)](/rlist_new/3.md),  [*rlist\_next*(3)](/rlist_next/3.md), [*rlist\_nth*(3)](/rlist_nth/3.md),  [*rlist\_prepend*(3)](/rlist_prepend/3.md), [*rlist\_prev*(3)](/rlist_prev/3.md),  [*rlist\_remove*(3)](/rlist_remove/3.md), [*roy*(3)](/roy/3.md)
