Btw, I have already called gtk_main_quit()  in the callback for GTK
destroy signal.   And here is the command I used to run Valgrind:

 G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind --tool=memcheck
--leak-check=full --leak-resolution=high --num-callers=30
--log-file=vgdump <my program>

Thanks
Han

On Tue, Aug 31, 2010 at 10:41 PM, Han <keepsim...@gmail.com> wrote:
> On Tue, Aug 31, 2010 at 8:37 AM, Eero Tamminen <eero.tammi...@nokia.com> 
> wrote:
>> Hi,
>>
>> ext Alexandre Fayolle wrote:
>>>
>>> On Tuesday 31 August 2010 09:07:01 Han wrote:
>>>>
>>>> Hi,
>>>> I am using Maemo 2.2 to develop some programs for Nokia 770. Things
>>>> run pretty well except sometime my program would crash for unknown
>>>> reason. Normally I start the program from x terminal, and  it would
>>>> crash with only message "Killed".
>>>>
>>>> I am wondering if possible to get a stack trace when the program
>>>> crashes?  so that I can find out where the crash happened in the code.
>>>
>>> This looks like the executable was killed by the OS.  This can happen on
>>> Linux
>>> because of memory exhaustion (Out Of Memory killer: see e.g. http://linux-
>>> mm.org/OOM_Killer for more information on that). I'd advise monitoring
>>> memory consumption of your program.
>>
>> And Valgrinding it on x86 to see what kind of memory leaks and
>> other issues it has.
>
> I tried Valgrind, and it did report memory leaks.  However, most are
> from gtk/gdk libs and not obvious to me if something is wrong in my
> program. For example:
>
> ==19494== 2,356 (256 direct, 2,100 indirect) bytes in 1 blocks are
> definitely lost in loss record 5,620 of 5,662
> ==19494==    at 0x4024D12: realloc (vg_replace_malloc.c:476)
> ==19494==    by 0x4747951: ??? (in /usr/lib/libfontconfig.so.1.3.0)
> ==19494==    by 0x47483C7: ??? (in /usr/lib/libfontconfig.so.1.3.0)
> ==19494==    by 0x4748A0B: ??? (in /usr/lib/libfontconfig.so.1.3.0)
> ==19494==    by 0x4748A4F: ??? (in /usr/lib/libfontconfig.so.1.3.0)
> ==19494==    by 0x473CE25: FcDefaultSubstitute (in
> /usr/lib/libfontconfig.so.1.3.0)
> ==19494==    by 0x4553A27: ??? (in /usr/lib/libpangocairo-1.0.so.0.2600.0)
> ==19494==    by 0x44E8627: ??? (in /usr/lib/libpangoft2-1.0.so.0.2600.0)
> ==19494==    by 0x44EB954: ??? (in /usr/lib/libpangoft2-1.0.so.0.2600.0)
> ==19494==    by 0x4680AF5: pango_font_map_load_fontset (in
> /usr/lib/libpango-1.0.so.0.2600.0)
> ==19494==    by 0x467E614: ??? (in /usr/lib/libpango-1.0.so.0.2600.0)
> ==19494==    by 0x467ECAE: pango_itemize_with_base_dir (in
> /usr/lib/libpango-1.0.so.0.2600.0)
> ==19494==    by 0x4687908: ??? (in /usr/lib/libpango-1.0.so.0.2600.0)
> ==19494==    by 0x4688F53: ??? (in /usr/lib/libpango-1.0.so.0.2600.0)
> ==19494==    by 0x468AB9A: pango_layout_get_pixel_extents (in
> /usr/lib/libpango-1.0.so.0.2600.0)
> ==19494==    by 0x40FDAD5: ??? (in /usr/lib/libgtk-x11-2.0.so.0.1800.3)
> ==19494==    by 0x40F6758: gtk_cell_renderer_get_size (in
> /usr/lib/libgtk-x11-2.0.so.0.1800.3)
> ==19494==    by 0x42B9CEA: gtk_tree_view_column_cell_get_size (in
> /usr/lib/libgtk-x11-2.0.so.0.1800.3)
> ==19494==    by 0x42B1517: ??? (in /usr/lib/libgtk-x11-2.0.so.0.1800.3)
> ==19494==    by 0x42B2C08: ??? (in /usr/lib/libgtk-x11-2.0.so.0.1800.3)
> ==19494==    by 0x42B30DC: ??? (in /usr/lib/libgtk-x11-2.0.so.0.1800.3)
> ==19494==    by 0x42B318D: ??? (in /usr/lib/libgtk-x11-2.0.so.0.1800.3)
> ==19494==    by 0x4444F77: ??? (in /usr/lib/libgdk-x11-2.0.so.0.1800.3)
> ==19494==    by 0x47E7100: ??? (in /lib/libglib-2.0.so.0.2200.3)
> ==19494==    by 0x47E8E87: g_main_context_dispatch (in
> /lib/libglib-2.0.so.0.2200.3)
> ==19494==    by 0x47EC72F: ??? (in /lib/libglib-2.0.so.0.2200.3)
> ==19494==    by 0x47ECB9E: g_main_loop_run (in /lib/libglib-2.0.so.0.2200.3)
> ==19494==    by 0x41A5418: gtk_main (in /usr/lib/libgtk-x11-2.0.so.0.1800.3)
> ==19494==    by 0x804D262: br_ui_init
> ==19494==    by 0x804C317: main
>
> Does this mean I should free something after gtk_main() returns ?
>
> Thanks
> Han
>
>>
>>
>>> You could also use strace to check what's happening in your program and
>>> what signal is received which causes termination.
>>>
>>> The OOM Killer uses SIGTERM, which your program can intercept if its
>>> memory consumption is not a bug.
>>
>> Kernel OOM killing doesn't use SIGTERM and isn't interceptable,
>> for a good reason.
>>
>>
>>        - Eero
>>
>> _______________________________________________
>> maemo-developers mailing list
>> maemo-developers@maemo.org
>> https://lists.maemo.org/mailman/listinfo/maemo-developers
>>
>
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to