---
name: "hashkit_is_allocated"
section: "3"
platform: "linux"
package: "libmemcached-awesome"
version: "1.1.4-4"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/hashkit_is_allocated"
---

# hashkit\_is\_allocated(3)

libhashkit Documentation

## NAME

hashkit\_is\_allocated - libhashkit Documentation

## SYNOPSIS

- **#include \<libhashkit-1.0/hashkit.h\>**

  Compile and link with -lhashkit

- **typedef struct hashkit\_st hashkit\_st**

  - **hashkit\_st \*hashkit\_create(hashkit\_st \*hash)**

  - **Parameters**

    **hash** -- memory address of a **hashkit\_st** struct; if a nullptr is passed, the struct will be dynamically allocated by libhashkit

  - **Returns**

    pointer to initialized **hashkit\_st** structure

- **hashkit\_st \*hashkit\_clone(hashkit\_st \*destination, const hashkit\_st \*ptr)**

  - **Parameters**

    - •

      **destination** -- memory address of a **hashkit\_st** struct; if a nullptr is passed, the struct will be dynamically allocated by libhashkit

    - •

      **ptr** -- pointer of the **hashkit\_st** struct to copy

  - **Returns**

    pointer to a **hashkit\_st** structure (**destination**, if not nullptr), initialized from **ptr**

- **void hashkit\_free(hashkit\_st \*hash)**

  - **Parameters**

    **hash** -- pointer to an initialized **hashkit\_st** struct

- **bool hashkit\_is\_allocated(const hashkit\_st \*hash)**

  - **Parameters**

    **hash** -- pointer to an initialized **hashkit\_st** struct

  - **Returns**

    bool, whether the **hash** struct was dynamically allocated

## DESCRIPTION

The **hashkit\_create()** function initializes a hashkit object for use. If you pass a nullptr argument for hash, then the memory for the object is allocated. If you specify a pre-allocated piece of memory, that is initialized for use.

The **hashkit\_clone()** function initializes a hashkit object much like **hashkit\_create()**, but instead of using default settings it will use the settings of the ptr hashkit object.

The **hashkit\_free()** frees any resources being consumed by the hashkit objects that were initialized with **hashkit\_create()** or **hashkit\_clone()**.

The **hashkit\_is\_allocated()** reports whether the memory was allocated for a hashkit object.

## RETURN VALUE

**hashkit\_create()** and **hashkit\_clone()** will return nullptr on failure or pointer to **hashkit\_st** on success.

**hashkit\_is\_allocated()** returns true if the memory for the hashkit object was allocated inside of **hashkit\_create()** or **hashkit\_clone()**, otherwise it is false and was user-supplied memory.

## SEE ALSO

**[libhashkit(3)](/libhashkit/3.md) \<https://linux.die.net/man/3/libhashkit\>** **[hashkit\_value(3)](/hashkit_value/3.md) \<https://linux.die.net/man/3/hashkit\_value\>** **hashkit\_function3) \<https://linux.die.net/man//hashkit\_function3)\>**
