Hi all,
I use valgrind to check memory on efl demo, but valgrind show error as shown 
below, attached are the efl demo codes, please help to advise where went wrong ?


sudo valgrind --tool=memcheck --leak-check=full ./edje-anchors
==37097== Memcheck, a memory error detector
==37097== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==37097== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==37097== Command: ./edje-anchors
==37097== 
key:Escape
==37097== 
==37097== HEAP SUMMARY:
==37097==     in use at exit: 246,790 bytes in 2,198 blocks
==37097==   total heap usage: 17,746 allocs, 15,548 frees, 6,874,546 bytes 
allocated
==37097== 
==37097== 10 bytes in 1 blocks are definitely lost in loss record 10 of 238
==37097==    at 0x4C2DE96: malloc (vg_replace_malloc.c:309)
==37097==    by 0x5D07489: strdup (strdup.c:42)
==37097==    by 0x72A8CBE: eina_vpath_resolve (eina_vpath.c:285)
==37097==    by 0x90128D9: _efreet_efreet_app_interface_set (efreet.c:49)
==37097==    by 0x9012F27: efreet_init (efreet.c:149)
==37097==    by 0x5803F36: edje_init (edje_main.c:78)
==37097==    by 0x400EED: main (in 
/home/lg/GSC/efl-1.21.1/src/examples/edje/edje-anchors)
==37097== 
==37097== 32 bytes in 1 blocks are definitely lost in loss record 49 of 238
==37097==    at 0x4C2FFAC: calloc (vg_replace_malloc.c:762)
==37097==    by 0x4FD5B28: generic_cache_new (evas_common_generic_cache.c:7)
==37097==    by 0x4FE9AE6: eng_engine_new (evas_engine.c:3880)
==37097==    by 0x4EAC544: evas_output_method_set (evas_main.c:1224)
==37097==    by 0x12C3F004: ecore_evas_software_x11_new_internal 
(ecore_evas_x.c:4153)
==37097==    by 0x554F606: ecore_evas_software_x11_new (ecore_evas.c:3831)
==37097==    by 0x554F7EA: _ecore_evas_constructor_software_x11 
(ecore_evas.c:780)
==37097==    by 0x55499EF: _ecore_evas_new_auto_discover (ecore_evas.c:1021)
==37097==    by 0x55499EF: ecore_evas_new (ecore_evas.c:1046)
==37097==    by 0x400F12: main (in 
/home/lg/GSC/efl-1.21.1/src/examples/edje/edje-anchors)
==37097== 
==37097== 82 bytes in 1 blocks are definitely lost in loss record 154 of 238
==37097==    at 0x4C2DE96: malloc (vg_replace_malloc.c:309)
==37097==    by 0x727B586: eina_module_new (eina_module.c:272)
==37097==    by 0x4F530F6: evas_module_find_type.part.3 (evas_module.c:601)
==37097==    by 0x4EA9E52: evas_render_method_lookup (evas_main.c:644)
==37097==    by 0x12C3EE2D: ecore_evas_software_x11_new_internal 
(ecore_evas_x.c:4086)
==37097==    by 0x554F606: ecore_evas_software_x11_new (ecore_evas.c:3831)
==37097==    by 0x554F7EA: _ecore_evas_constructor_software_x11 
(ecore_evas.c:780)
==37097==    by 0x55499EF: _ecore_evas_new_auto_discover (ecore_evas.c:1021)
==37097==    by 0x55499EF: ecore_evas_new (ecore_evas.c:1046)
==37097==    by 0x400F12: main (in 
/home/lg/GSC/efl-1.21.1/src/examples/edje/edje-anchors)
==37097== 
==37097== 232 (192 direct, 40 indirect) bytes in 1 blocks are definitely lost 
in loss record 190 of 238
==37097==    at 0x4C2FFAC: calloc (vg_replace_malloc.c:762)
==37097==    by 0x703431E: _efl_add_internal_start (eo.c:896)
==37097==    by 0x4E8F279: evas_device_add_full (evas_device.c:190)
==37097==    by 0x4EAC655: evas_output_method_set (evas_main.c:1251)
==37097==    by 0x12C3F004: ecore_evas_software_x11_new_internal 
(ecore_evas_x.c:4153)
==37097==    by 0x554F606: ecore_evas_software_x11_new (ecore_evas.c:3831)
==37097==    by 0x554F7EA: _ecore_evas_constructor_software_x11 
(ecore_evas.c:780)
==37097==    by 0x55499EF: _ecore_evas_new_auto_discover (ecore_evas.c:1021)
==37097==    by 0x55499EF: ecore_evas_new (ecore_evas.c:1046)
==37097==    by 0x400F12: main (in 
/home/lg/GSC/efl-1.21.1/src/examples/edje/edje-anchors)
==37097== 
==37097== 232 (192 direct, 40 indirect) bytes in 1 blocks are definitely lost 
in loss record 191 of 238
==37097==    at 0x4C2FFAC: calloc (vg_replace_malloc.c:762)
==37097==    by 0x703431E: _efl_add_internal_start (eo.c:896)
==37097==    by 0x4E8F279: evas_device_add_full (evas_device.c:190)
==37097==    by 0x4EAC6A0: evas_output_method_set (evas_main.c:1255)
==37097==    by 0x12C3F004: ecore_evas_software_x11_new_internal 
(ecore_evas_x.c:4153)
==37097==    by 0x554F606: ecore_evas_software_x11_new (ecore_evas.c:3831)
==37097==    by 0x554F7EA: _ecore_evas_constructor_software_x11 
(ecore_evas.c:780)
==37097==    by 0x55499EF: _ecore_evas_new_auto_discover (ecore_evas.c:1021)
==37097==    by 0x55499EF: ecore_evas_new (ecore_evas.c:1046)
==37097==    by 0x400F12: main (in 
/home/lg/GSC/efl-1.21.1/src/examples/edje/edje-anchors)
==37097== 
==37097== 232 (192 direct, 40 indirect) bytes in 1 blocks are definitely lost 
in loss record 192 of 238
==37097==    at 0x4C2FFAC: calloc (vg_replace_malloc.c:762)
==37097==    by 0x703431E: _efl_add_internal_start (eo.c:896)
==37097==    by 0x4E8F279: evas_device_add_full (evas_device.c:190)
==37097==    by 0x4EAC6DE: evas_output_method_set (evas_main.c:1260)
==37097==    by 0x12C3F004: ecore_evas_software_x11_new_internal 
(ecore_evas_x.c:4153)
==37097==    by 0x554F606: ecore_evas_software_x11_new (ecore_evas.c:3831)
==37097==    by 0x554F7EA: _ecore_evas_constructor_software_x11 
(ecore_evas.c:780)
==37097==    by 0x55499EF: _ecore_evas_new_auto_discover (ecore_evas.c:1021)
==37097==    by 0x55499EF: ecore_evas_new (ecore_evas.c:1046)
==37097==    by 0x400F12: main (in 
/home/lg/GSC/efl-1.21.1/src/examples/edje/edje-anchors)
==37097== 
==37097== LEAK SUMMARY:
==37097==    definitely lost: 700 bytes in 6 blocks
==37097==    indirectly lost: 120 bytes in 3 blocks
==37097==      possibly lost: 0 bytes in 0 blocks
==37097==    still reachable: 245,970 bytes in 2,189 blocks
==37097==         suppressed: 0 bytes in 0 blocks
==37097== Reachable blocks (those to which a pointer was found) are not shown.
==37097== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==37097== 
==37097== For lists of detected and suppressed errors, rerun with: -s
==37097== ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 0 from 0)
/**
 * Simple Edje example for layouting parts with anchors.
 *
 * You'll need at least one Evas engine built for it (excluding the
 * buffer one). See stdout/stderr for output.
 *
 * @verbatim
 * edje_cc edje-anchors.edc && gcc -o edje-anchors edje-anchors.c `pkg-config 
--libs --cflags evas ecore ecore-evas edje`
 * @endverbatim
 */

#ifdef HAVE_CONFIG_H
# include "config.h"
#else
# define EINA_UNUSED
#endif

#include <Ecore.h>
#include <Ecore_Evas.h>
#include <Edje.h>
#include <libgen.h>

#define WIDTH 400
#define HEIGHT 400

static void
_on_key_down(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, Evas_Object *obj, 
void *event_info)
{
   Evas_Event_Key_Down *ev;
   double               ft;

   ev = (Evas_Event_Key_Down *)event_info;
printf("key:%s\n", ev->key);
   if (!strcmp(ev->key, "Escape"))
     ecore_main_loop_quit();
}


int
main(int argc EINA_UNUSED, char **argv)
{
   char path[PATH_MAX] = { 0, };

   ecore_init();
   ecore_evas_init();
   edje_init();

   Ecore_Evas *ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
   Evas *e = ecore_evas_get(ee);
   ecore_evas_show(ee);

   Evas_Object *bg = evas_object_rectangle_add(e);
   evas_object_color_set(bg, 64, 64, 64, 255);
   evas_object_resize(bg, WIDTH, HEIGHT);
   evas_object_show(bg);

   snprintf(path, sizeof(path), "%s/edje-anchors.edj", dirname(*argv));

   Evas_Object *edje = edje_object_add(e);
   edje_object_file_set(edje, path, "main");
   evas_object_resize(edje, WIDTH, HEIGHT);

   evas_object_event_callback_add(edje, EVAS_CALLBACK_KEY_DOWN,
                                  _on_key_down, NULL);  
   evas_object_focus_set(edje, EINA_TRUE);
   
   evas_object_show(edje);

   
   
   ecore_main_loop_begin();

   edje_shutdown();
   ecore_evas_shutdown();
   ecore_shutdown();

   return 0;
}

Attachment: edje-anchors.edc
Description: Binary data

_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to