On Thu, Jun 2, 2011 at 4:09 AM, Cedric BAIL <cedric.b...@free.fr> wrote: > On Wed, Jun 1, 2011 at 9:27 PM, Rafael Antognolli > <antogno...@profusion.mobi> wrote: >> On Thu, Sep 9, 2010 at 4:08 AM, Enlightenment SVN >> <no-re...@enlightenment.org> wrote: >>> Log: >>> lots of cleanups... actually tested! :) >>> >>> >>> Author: raster >>> Date: 2010-09-09 00:08:10 -0700 (Thu, 09 Sep 2010) >>> New Revision: 52030 >> >>> static void >>> -_evas_preload_thread_end(Evas_Preload_Pthread_Data *pth) >>> +_evas_preload_thread_end(void *data) >>> { >>> - Evas_Preload_Pthread_Data *p; >>> + Evas_Preload_Pthread_Data *pth = data; >>> + Evas_Preload_Pthread_Data *p = NULL; >>> >>> - if (pthread_join(pth->thread, (void **) &p) != 0) >>> - return ; >>> - >>> - _evas_preload_thread = eina_list_remove(_evas_preload_thread, pth); >>> + if (pthread_join(pth->thread, (void **)&p) != 0) free(p); >>> } >> >> Hello raster, I know this is old, but I can't understand it... why do >> you only free the data struct on pthread_join error? Shouldn't you >> free it always? >> >> I can always get leaks on almost every call that I'm doing to >> edje_object_preload() on my program. I can send you a test case if >> necessary... > > Test case ! Test case ! Send it ! Send it !
Test case attached. It leaks for every thread started for preload. Just give images as arguments in the command line. It should leak something like this: ==10047== 64 bytes in 8 blocks are definitely lost in loss record 44 of 78 ==10047== at 0x4C267CE: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==10047== by 0x5302327: evas_preload_thread_run (evas_preload.c:197) ==10047== by 0x52FE624: _evas_cache_image_entry_preload_add (evas_cache_image.c:475) ==10047== by 0x5300199: evas_cache_image_preload_data (evas_cache_image.c:1270) ==10047== by 0xAE06CB6: ??? ==10047== by 0x52AEF16: evas_object_image_preload (evas_object_image.c:1013) ==10047== by 0x400EAF: _image_preloaded_cb (test-evas-preload.c:29) ==10047== by 0x52A06E6: evas_object_event_callback_call (evas_callbacks.c:222) ==10047== by 0x52BC270: evas_object_inform_call_image_preloaded (evas_object_inform.c:68) ==10047== by 0x52FE3EA: _evas_cache_image_async_end (evas_cache_image.c:419) ==10047== by 0x5301FC1: _evas_preload_thread_done (evas_preload.c:70) ==10047== by 0x52F72D1: evas_async_events_process (evas_async_events.c:90) -- Rafael Antognolli ProFUSION embedded systems http://profusion.mobi
#include <Evas.h> #include <Ecore.h> #include <Ecore_Evas.h> #define WIDTH 800 #define HEIGHT 600 static Evas_Object **pictures = NULL; static int npictures = 0; static int pic = 0; static void _image_preloaded_cb(void *data, Evas *e, Evas_Object *o, void *event_info) { evas_object_show(o); printf("loading pic %d of %d\n", pic + 1, npictures); if (++pic >= npictures) { ecore_main_loop_quit(); return; } evas_object_image_preload(pictures[pic], EINA_FALSE); } int main(int argc, const char *argv[]) { Ecore_Evas *ee; Evas *e; Ecore_Timer *timer = NULL; Evas_Object *picture; int i; if (argc <= 1) return 0; evas_init(); ecore_init(); ecore_evas_init(); ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); e = ecore_evas_get(ee); ecore_evas_show(ee); printf("trying to load %d images\n bytes = %zd\n", argc - 1, sizeof(Evas_Object *) * (argc - 1)); pictures = malloc(sizeof(Evas_Object *) * (argc - 1)); npictures = argc - 1; for (i = 1; i < argc; i++) { picture = evas_object_image_filled_add(e); evas_object_move(picture, 0, 0); evas_object_resize(picture, WIDTH, HEIGHT); evas_object_hide(picture); printf("loading: '%s'\n", argv[i]); evas_object_image_file_set(picture, argv[i], ""); evas_object_event_callback_add(picture, EVAS_CALLBACK_IMAGE_PRELOADED, _image_preloaded_cb, NULL); pictures[i - 1] = picture; } evas_object_image_preload(pictures[pic], EINA_FALSE); ecore_main_loop_begin(); ecore_evas_free(ee); free(pictures); ecore_evas_shutdown(); ecore_shutdown(); evas_shutdown(); return 0; }
------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2
_______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel