---
name: "rq_init"
section: "3"
platform: "linux"
package: "liblcrq0.0"
version: "0.2.3-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rq_init"
---

# rq\_init(3)

create and free RaptorQ contexts

## NAME

rq\_init, rq\_free - create and free RaptorQ contexts

## SYNOPSIS

```
#include <lcrq.h>
```

**rq\_t \*rq\_init(const uint64\_t** *F***, const uint16\_t** *T***);** **void rq\_free(rq\_t** *\*rq***);**

Compile and link with *-llcrq*.

## DESCRIPTION

**rq\_init**() creates a new RaptorQ context and sets up the environment.

*F* The size of the object to encode. This must be a positive integer up to 946270874880.

*T* The symbol size. This is generally the size of the packet payload we intend to send. This must be a multiple of the Alignment parameter (4).

Call [**rq\_free**(3)](/rq_free/3.md) when done.

**rq\_free**() invalidates and frees a RaptorQ context created with [**rq\_init**(3)](/rq_init/3.md)

## RETURN VALUE

**rq\_init**() returns a pointer to a *rq\_t* handle. On error returns NULL and sets *errno* to **ENOMEM**.

The **rq\_free**() function returns no value.

## ERRORS

**rq\_init**() can fail with the following errors:

- **ENOMEM**

  Out of memory. Possibly, the application hit the **RLIMIT\_AS** or **RLIMIT\_DATA** limit described in [**getrlimit**(2)](/getrlimit/2.md).

## EXAMPLE

### Program source

```
rq_t *rq;
rq = rq_init(filesize, 1024);
/* your program here */
rq_free(rq); /* free context when done */
```

## SEE ALSO

[**rq\_encode**(3)](/rq_encode/3.md), [**rq\_decode**(3)](/rq_decode/3.md), [**rq\_symbol**(3)](/rq_symbol/3.md), [**lcrq**(7)](/lcrq/7.md)
