Example #1
0
/*
    vpx_memory_tracker_destroy()
    If our global struct was initialized zeros out all its members,
    frees memory and destroys it's mutex
*/
void vpx_memory_tracker_destroy()
{

    if (!memory_tracker_lock_mutex())
    {
        struct mem_block *p  = memtrack.head,
                                  * p2 = memtrack.head;

        memory_tracker_dump();

        while (p)
    {
            p2 = p;
            p  = p->next;

            MEM_TRACK_FREE(p2);
        }

        memtrack.head              = NULL;
        memtrack.tail              = NULL;
        memtrack.len               = 0;
        memtrack.current_allocated = 0;
        memtrack.max_allocated     = 0;

        if ((g_logging.type == 0) && (g_logging.file != 0)) //&& (g_logging.file != stderr) )
        {
#if !defined(NDS_NITRO)
            fclose(g_logging.file);
#endif
            g_logging.file = NULL;
        }

        memory_tracker_unlock_mutex();

        g_b_mem_tracker_inited = 0;

    }

}
Example #2
0
/*
    vpx_memory_tracker_dump()
    Locks the memory tracker's mutex and calls the internal
    library function to dump the current contents of the
    global memory allocation list
*/
void vpx_memory_tracker_dump() {
  if (!memory_tracker_lock_mutex()) {
    memory_tracker_dump();
    memory_tracker_unlock_mutex();
  }
}