> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs-staging.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Object Utilities

> Utility functions and macros for Objects.

## Functions

### `Object_release`

```cpp theme={null}
int32_t Object_release(OBJECT_CONSUMED Object o)
```

### `Object_retain`

```cpp theme={null}
int32_t Object_retain(Object o)
```

### `Object_replace`

```cpp theme={null}
void Object_replace(Object *loc, Object objNew)
```

## Macros

### `OBJECT_NOT_RETAINED`

This annotation is used when a returned value or output parameter conveys an object reference but the function will not increment the reference count.

```c theme={null}
#define OBJECT_NOT_RETAINED 
```

### `OBJECT_CONSUMED`

This annotation is used when an input parameter is an object reference that will be released by the function.

```c theme={null}
#define OBJECT_CONSUMED 
```

### `Object_isNull`

Check if Object is NULL.

```c theme={null}
#define Object_isNull ( (o).invoke == NULL )
```

### `Object_RELEASE_IF`

Conditionally release an object if not NULL.

```c theme={null}
#define Object_RELEASE_IF do { Object o_ = (o); if (!Object_isNull(o_)) (void) Object_release(o_); } while (0)
```

### `Object_ASSIGN`

Assign a given reference to the MINK object.

```c theme={null}
#define Object_ASSIGN Object_replace(&(loc), (obj))
```

### `Object_ASSIGN_NULL`

```c theme={null}
#define Object_ASSIGN_NULL Object_replace(&(loc), Object_NULL)
```

### `Object_INIT`

Initialize a MINK object.

```c theme={null}
#define Object_INIT do {                                          \
    Object o_ = (obj);                          \
    (loc) = o_;                                 \
    if (!Object_isNull(o_)) {                   \
      Object_retain(o_);                        \
    }                                           \
  } while(0)
```
