Exemple #1
0
static void
_eio_pool_free(Eio_Alloc_Pool *pool, void *data)
{
   if (pool->count >= EIO_PROGRESS_LIMIT)
     {
        eina_spinlock_take(&memory_pool_lock);
        memory_pool_usage -= pool->mem_size;
        eina_spinlock_release(&memory_pool_lock);
        free(data);

        if (memory_pool_limit > 0 &&
            memory_pool_usage < memory_pool_limit)
          {
             eina_lock_take(&(memory_pool_mutex));
             if (memory_pool_suspended)
               eina_condition_broadcast(&(memory_pool_cond));
             eina_lock_release(&(memory_pool_mutex));
          }
     }
   else
     {
        eina_lock_take(&(pool->lock));
        eina_trash_push(&pool->trash, data);
        pool->count++;
        eina_lock_release(&(pool->lock));
     }
}
Exemple #2
0
EAPI void
eina_rectangle_free(Eina_Rectangle *rect)
{
   EINA_SAFETY_ON_NULL_RETURN(rect);

   if (_eina_rectangles_count > BUCKET_THRESHOLD)
      eina_mempool_free(_eina_rectangle_mp, rect);
   else
     {
        eina_trash_push(&_eina_rectangles, rect);
        _eina_rectangles_count++;
     }
}
Exemple #3
0
static void
eina_one_big_free(void *data, void *ptr)
{
   One_Big *pool = data;

   if (!eina_lock_take(&pool->mutex))
     {
#ifdef EINA_HAVE_DEBUG_THREADS
        assert(eina_thread_equal(pool->self, eina_thread_self()));
#endif
     }

   if ((void *)pool->base <= ptr
       && ptr < (void *)(pool->base + (pool->max * pool->item_size)))
     {
        eina_trash_push(&pool->empty, ptr);
        pool->usage--;

#ifndef NVALGRIND
        VALGRIND_MEMPOOL_FREE(pool, ptr);
#endif
     }
   else
     {
#ifndef NDEBUG
        Eina_Inlist *it;
#endif
        Eina_Inlist *il;

        il = OVER_MEM_TO_LIST(pool, ptr);

#ifndef NDEBUG
        for (it = pool->over_list; it != NULL; it = it->next)
          if (it == il) break;

        assert(it != NULL);
#endif

        pool->over_list = eina_inlist_remove(pool->over_list, il);

#ifndef NVALGRIND
        VALGRIND_MEMPOOL_FREE(pool, ptr);
#endif
        free(ptr);
        pool->over--;
     }

   eina_lock_release(&pool->mutex);
}
Exemple #4
0
static void
_eio_pool_free(Eio_Alloc_Pool *pool, void *data)
{
   if (pool->count >= EIO_PROGRESS_LIMIT)
     {
        free(data);
     }
   else
     {
        EIO_MUTEX_LOCK(pool);
        eina_trash_push(&pool->trash, data);
        pool->count++;
        EIO_MUTEX_UNLOCK(pool);
     }
}
Exemple #5
0
void id_keeper_free(struct id_keeper *keeper, int64_t id){
  if(!keeper->free_id)
    eina_trash_init(&keeper->free_id);
  eina_trash_push(&keeper->free_id, &keeper->id_array[id]);
}