### Function

# GLib VariantBuilder new

since: 2.24

#### Declaration

    GVariantBuilder*
    g_variant_builder_new (
      const GVariantType* type
    )

#### Description

Allocates and initialises a new `GVariantBuilder`.

You should call `g_variant_builder_unref()` on the return value when it is no longer needed. The memory will not be automatically freed by any other call.

In most cases it is easier to place a `GVariantBuilder` directly on the stack of the calling function and initialise it with g_variant_builder_init().

Available since: 2.24

#### Parameters

`type`

  Type: `GVariantType`

  A container type.

  The data is owned by the caller of the function.

#### Return value

Type: `GVariantBuilder`

A `GVariantBuilder`.

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