barbieri pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=9eba6bf2e7c78016f14d47f42e8558a1e0fb2370

commit 9eba6bf2e7c78016f14d47f42e8558a1e0fb2370
Author: Gustavo Sverzut Barbieri <barbi...@profusion.mobi>
Date:   Sat Dec 3 10:35:27 2016 -0200

    eo: do not use eina_trash when running on valgrind.
    
    This allows valgrind to show when the object was created and deleted.
---
 src/Makefile_Eo.am |  5 ++++-
 src/lib/eo/eo.c    | 12 +++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/Makefile_Eo.am b/src/Makefile_Eo.am
index 0bf2453..e2551bc 100644
--- a/src/Makefile_Eo.am
+++ b/src/Makefile_Eo.am
@@ -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@
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index a540492..dd6cff6 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -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));

-- 


Reply via email to