eo: do not use eina_trash when running on valgrind.

This allows valgrind to show when the object was created and deleted.
This commit is contained in:
Gustavo Sverzut Barbieri 2016-12-03 10:35:27 -02:00
parent 2e0fcbe5b4
commit 9eba6bf2e7
2 changed files with 15 additions and 2 deletions

View File

@ -34,7 +34,10 @@ lib/eo/eo_add_fallback.h \
lib/eo/eo_private.h \
lib/eo/efl_future.c
lib_eo_libeo_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @EO_CFLAGS@
lib_eo_libeo_la_CPPFLAGS = \
-I$(top_builddir)/src/lib/efl \
@EO_CFLAGS@ \
@VALGRIND_CFLAGS@
lib_eo_libeo_la_LIBADD = @EO_LIBS@
lib_eo_libeo_la_DEPENDENCIES = @EO_INTERNAL_LIBS@
lib_eo_libeo_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@

View File

@ -26,6 +26,12 @@
#include <execinfo.h>
#endif
#ifdef HAVE_VALGRIND
# include <valgrind.h>
# include <memcheck.h>
#endif
static Eina_Bool _eo_trash_bypass = EINA_FALSE;
#define EO_CLASS_IDS_FIRST 1
#define EFL_OBJECT_OP_IDS_FIRST 1
@ -980,7 +986,7 @@ _eo_free(_Eo_Object *obj)
_eo_id_release((Eo_Id) _eo_obj_id_get(obj));
eina_spinlock_take(&klass->objects.trash_lock);
if (klass->objects.trash_count <= 8)
if ((klass->objects.trash_count <= 8) && (EINA_LIKELY(!_eo_trash_bypass)))
{
eina_trash_push(&klass->objects.trash, obj);
klass->objects.trash_count++;
@ -2027,6 +2033,10 @@ efl_object_init(void)
eina_init();
#if HAVE_VALGRIND
_eo_trash_bypass = RUNNING_ON_VALGRIND;
#endif
_efl_object_main_thread = eina_thread_self();
_eo_sz = EO_ALIGN_SIZE(sizeof(_Eo_Object));