# mysql\_thread\_end

## Syntax

```c
void mysql_thread_end(void );
```

## Description

The `mysql_thread_end()` function needs to be called before a client thread ends. It will release thread-specific memory, which was allocated by a previous [mysql\_thread\_init()](/docs/connectors/mariadb-connector-c/api-functions/mysql_thread_init.md) call. Returns void.

{% hint style="info" %}
Unlike [mysql\_thread\_init()](/docs/connectors/mariadb-connector-c/api-functions/mysql_thread_init.md) `mysql_thread_end()` will not be invoked automatically if the thread ends. To avoid memory leaks `mysql_thread_end()` must be called explicitly.
{% endhint %}

{% hint style="warning" %}
This function has been deprecated since MariaDB Connector/C 3.0.0.
{% endhint %}

## See also

* [mysql\_thread\_init()](/docs/connectors/mariadb-connector-c/api-functions/mysql_thread_init.md)
* [mysql\_thread\_safe()](/docs/connectors/mariadb-connector-c/api-functions/mysql_thread_safe.md)

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_thread_end.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
