## TeplObjectCounters

TeplObjectCounters — Utility to detect memory leaks

## Functions

void | tepl_object_counters_init ()
void | tepl_object_counters_increment ()
void | tepl_object_counters_decrement ()
void | tepl_object_counters_final_check ()

## Includes

    #include <tepl/tepl.h>

## Description

TeplObjectCounters is a utility to detect memory leaks, by counting the number of objects constructed and destructed, per type.

It must be used manually by calling its functions explicitly.

It is not intended to be used in performance-sensitive code areas.

## Functions

### tepl_object_counters_init ()

    void
    tepl_object_counters_init (void);

Must be called before using the other TeplObjectCounters functions, usually early in the ``main()`` function.

Since: 6.10

### tepl_object_counters_increment ()

    void
    tepl_object_counters_increment (const gchar *type);

Increments the counter for `type` .

For a GObject class, this function must be called in the ``_init()`` function, when an instance is created.

#### Parameters

type | the object type, as a string. |

Since: 6.10

### tepl_object_counters_decrement ()

    void
    tepl_object_counters_decrement (const gchar *type);

Decrements the counter for `type` .

For a GObject class, this function must be called in the ``_finalize()`` destructor function.

#### Parameters

type | the object type, as a string. |

Since: 6.10

### tepl_object_counters_final_check ()

    void
    tepl_object_counters_final_check (void);

Prints a warning for each type for which the counter hasn't reached zero.

This function is intended to be called once, towards the end of the ``main()`` function.

After calling this function, the other TeplObjectCounters functions must not be called anymore.

Since: 6.10