---
name: "dtk_destroy_texture"
section: "3"
platform: "linux"
package: "libdrawtk-dev"
version: "2.0-2.1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/dtk_destroy_texture"
---

# dtk\_destroy\_texture(3)

Free a texture

## NAME

dtk\_destroy\_texture - Free a texture

## SYNOPSIS

**#include \<drawtk.h\>**

**void dtk\_destroy\_texture(dtk\_htex** *tex***);**\

## DESCRIPTION

This function frees the ressource associated with a texture *tex*. If the texture is used several times, i.e. several call to **dtk\_load\_image**() with the same image path, it decreases the number of uses by one.

Calling **dtk\_destroy\_texture**() on each created texture is currently not mandatory since all texture remaining textures are destroyed when the last window is closed.  However, if no window can be closed (for example, no window has been created), **dtk\_destroy\_texture**() should be called on each created texture to avoid any memory leak.

**dtk\_destroy\_texture**() is thread-safe.

## RETURN VALUE

None

## SEE ALSO

[**dtk\_load\_image**(3)](/dtk_load_image/3.md), [**dtk\_close**(3)](/dtk_close/3.md),
