Hello.
I wrote a small program to demonstrate it. Here it is:
#include <Ecore.h>
#include <Ecore_Config.h>
#include <stdio.h>
/* Complile with
* gcc `ecore-config --libs` ecore_config_memory_leak.c -o
ecore_config_memory_leak
* Then run with
* valgrind --leak-check=full --show-reachable=yes
./ecore_config_memory_leak
* Hit Ctrl+C and see memory leaks.
*/
int kill_self( void *data, int type, void *ev )
{
printf( "Killing self...\n" );
ecore_main_loop_quit();
return 1;
}
int main()
{
ecore_init();
ecore_config_init( "ecore_config_memory_leak" );
ecore_event_handler_add( ECORE_EVENT_SIGNAL_EXIT, kill_self, NULL );
ecore_main_loop_begin();
ecore_config_shutdown();
ecore_shutdown();
}
I'm really not sure that my code is right. But I think there should be
no leaks.
This is what valgrind reports:
==6761== LEAK SUMMARY:
==6761== definitely lost: 30 bytes in 1 blocks.
==6761== possibly lost: 0 bytes in 0 blocks.
==6761== still reachable: 788 bytes in 23 blocks.
==6761== suppressed: 0 bytes in 0 blocks.
I also attached full valgrind report too.
Regards, ptomaine//
#include <Ecore.h>
#include <Ecore_Config.h>
#include <stdio.h>
/* Complile with
* gcc `ecore-config --libs` ecore_config_memory_leak.c -o ecore_config_memory_leak
* Then run with
* valgrind --leak-check=full --show-reachable=yes ./ecore_config_memory_leak
* Hit Ctrl+C and see memory leaks.
*/
int kill_self( void *data, int type, void *ev )
{
printf( "Killing self...\n" );
ecore_main_loop_quit();
return 1;
}
int main()
{
ecore_init();
ecore_config_init( "ecore_config_memory_leak" );
ecore_event_handler_add( ECORE_EVENT_SIGNAL_EXIT, kill_self, NULL );
ecore_main_loop_begin();
ecore_config_shutdown();
ecore_shutdown();
}
==6761== Memcheck, a memory error detector.
==6761== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.
==6761== Using LibVEX rev 1606, a library for dynamic binary translation.
==6761== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==6761== Using valgrind-3.2.0, a dynamic binary instrumentation framework.
==6761== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.
==6761== For more details, rerun with: -v
==6761==
Killing self...
==6761==
==6761== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 79 from 1)
==6761== malloc/free: in use at exit: 818 bytes in 24 blocks.
==6761== malloc/free: 97 allocs, 73 frees, 20,161 bytes allocated.
==6761== For counts of detected errors, rerun with: -v
==6761== searching for pointers to 24 not-freed blocks.
==6761== checked 331,360 bytes.
==6761==
==6761== 30 bytes in 1 blocks are definitely lost in loss record 1 of 6
==6761== at 0x40215E8: malloc (in
/usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==6761== by 0x43E136F: strdup (in /lib/libc-2.4.so)
==6761== by 0x417202D: (within /usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41720D1: (within /usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41722DA: ecore_config_typed_default (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x417250B: ecore_config_string_default (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x4172640: (within /usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41726DE: ecore_config_init (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x8048853: main (in
/home/ptomaine/projects/ecore_config_memory_leak/ecore_config_memory_leak)
==6761==
==6761==
==6761== 44 bytes in 1 blocks are still reachable in loss record 2 of 6
==6761== at 0x402070E: calloc (in
/usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==6761== by 0x403293D: ecore_timer_add (in /usr/lib/libecore.so.1.0.0)
==6761== by 0x4173875: _ecore_config_ipc_init (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x4171559: (within /usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41725F7: (within /usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41726DE: ecore_config_init (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x8048853: main (in
/home/ptomaine/projects/ecore_config_memory_leak/ecore_config_memory_leak)
==6761==
==6761==
==6761== 96 bytes in 6 blocks are still reachable in loss record 3 of 6
==6761== at 0x402070E: calloc (in
/usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==6761== by 0x402A78A: ecore_event_handler_del (in
/usr/lib/libecore.so.1.0.0)
==6761== by 0x4168F01: ecore_ipc_shutdown (in /usr/lib/libecore_ipc.so.1.0.0)
==6761== by 0x4173F8B: _ecore_config_ipc_ecore_exit (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x4173908: _ecore_config_ipc_exit (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x4171864: ecore_config_system_shutdown (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41718F6: ecore_config_shutdown (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x8048879: main (in
/home/ptomaine/projects/ecore_config_memory_leak/ecore_config_memory_leak)
==6761==
==6761==
==6761== 104 bytes in 2 blocks are still reachable in loss record 4 of 6
==6761== at 0x402070E: calloc (in
/usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==6761== by 0x4030037: ecore_main_fd_handler_add (in
/usr/lib/libecore.so.1.0.0)
==6761== by 0x4163D81: ecore_con_server_add (in
/usr/lib/libecore_con.so.1.0.0)
==6761== by 0x4168DD6: ecore_ipc_server_add (in
/usr/lib/libecore_ipc.so.1.0.0)
==6761== by 0x417419A: _ecore_config_ipc_ecore_init (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41737C1: _ecore_config_ipc_init (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x4171559: (within /usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41725F7: (within /usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41726DE: ecore_config_init (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x8048853: main (in
/home/ptomaine/projects/ecore_config_memory_leak/ecore_config_memory_leak)
==6761==
==6761==
==6761== 128 bytes in 1 blocks are still reachable in loss record 5 of 6
==6761== at 0x40216C2: realloc (in
/usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==6761== by 0x402A8A8: ecore_event_handler_add (in
/usr/lib/libecore.so.1.0.0)
==6761== by 0x41741BA: _ecore_config_ipc_ecore_init (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41737C1: _ecore_config_ipc_init (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x4171559: (within /usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41725F7: (within /usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41726DE: ecore_config_init (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x8048853: main (in
/home/ptomaine/projects/ecore_config_memory_leak/ecore_config_memory_leak)
==6761==
==6761==
==6761== 416 bytes in 13 blocks are still reachable in loss record 6 of 6
==6761== at 0x402070E: calloc (in
/usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==6761== by 0x402A815: ecore_event_handler_add (in
/usr/lib/libecore.so.1.0.0)
==6761== by 0x4168FC4: ecore_ipc_init (in /usr/lib/libecore_ipc.so.1.0.0)
==6761== by 0x4174080: _ecore_config_ipc_ecore_init (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41737C1: _ecore_config_ipc_init (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x4171559: (within /usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41725F7: (within /usr/lib/libecore_config.so.1.0.0)
==6761== by 0x41726DE: ecore_config_init (in
/usr/lib/libecore_config.so.1.0.0)
==6761== by 0x8048853: main (in
/home/ptomaine/projects/ecore_config_memory_leak/ecore_config_memory_leak)
==6761==
==6761== LEAK SUMMARY:
==6761== definitely lost: 30 bytes in 1 blocks.
==6761== possibly lost: 0 bytes in 0 blocks.
==6761== still reachable: 788 bytes in 23 blocks.
==6761== suppressed: 0 bytes in 0 blocks.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel