### Function

# GLib ByteArray new_take

since: 2.32

#### Declaration

    GByteArray*
    g_byte_array_new_take (
      guint8* data,
      gsize len
    )

#### Description

Creates a byte array containing the `data`. After this call, `data` belongs to the `GByteArray` and may no longer be modified by the caller. The memory of `data` has to be dynamically allocated and will eventually be freed with g_free().

Do not use it if `len` is greater than `G_MAXUINT`. `GByteArray` stores the length of its data in #guint, which may be shorter than

# gsize.

Available since: 2.32

#### Parameters

`data`

  Type: An array of `guint8`

  Byte data for the array.

  The length of the array is specified in the `len` argument.
  The called function takes ownership of the data, and is responsible for freeing it.

`len`

  Type: `gsize`

  Length of `data`.

#### Return value

Type: An array of `guint8`

A new `GByteArray`.

The caller of the function takes ownership of the data, and is responsible for freeing it.