Author Topic: Memleak fixed in code completion plugin  (Read 6177 times)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Memleak fixed in code completion plugin
« on: August 11, 2005, 10:03:08 pm »
Yesterday I fixed a memory leak in the code completion plugin (and one or two crashes in the SDK). I haven't been able to test it under linux, but I need all unix users to test it and notify if it stops crashing now.

You need to download it with CVS.

The tag to download is: SNAPSHOT_AUG_11_2005

Thank you.

Offline CleverFool

  • Single posting newcomer
  • *
  • Posts: 7
Re: Memleak fixed in code completion plugin
« Reply #1 on: August 11, 2005, 11:14:07 pm »
Code: [Select]
cvs -z3 -d:pserver:[email protected]:/cvsroot/codeblocks update -C -r SNAPSHOT_AUG_11_2005
cvs [update aborted]: no such tag SNAPSHOT_AUG_11_2005

Just latest sources (with simple CVS update) gives me:

Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1230419024 (LWP 8640)]
0xb7e61cfb in wxThreadInternal::PthreadStart () from /usr/lib/libwx_gtk2-2.4.soProgram received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1230419024 (LWP 8640)]
0xb7e61cfb in wxThreadInternal::PthreadStart () from /usr/lib/libwx_gtk2-2.4.so
(gdb) bt
#0  0xb7e61cfb in wxThreadInternal::PthreadStart ()
   from /usr/lib/libwx_gtk2-2.4.so
#1  0xb7e61ecc in wxPthreadStart () from /usr/lib/libwx_gtk2-2.4.so
#2  0xb77dcccd in start_thread () from /lib/tls/libpthread.so.0
#3  0xb776fb0e in clone () from /lib/tls/libc.so.6

(gdb) bt
#0  0xb7e61cfb in wxThreadInternal::PthreadStart ()
   from /usr/lib/libwx_gtk2-2.4.so
#1  0xb7e61ecc in wxPthreadStart () from /usr/lib/libwx_gtk2-2.4.so
#2  0xb77dcccd in start_thread () from /lib/tls/libpthread.so.0
#3  0xb776fb0e in clone () from /lib/tls/libc.so.6

I'll try to recompile later with debugging info....

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Memleak fixed in code completion plugin
« Reply #2 on: August 12, 2005, 12:49:19 am »
Hmmm... if you can't find the tag it means the anonymous CVS hasn't been updated yet. But good idea! Please recompile with debugging info! That way we can see what's going on. (This is something i've asked for so much time :( )

Offline CleverFool

  • Single posting newcomer
  • *
  • Posts: 7
Re: Memleak fixed in code completion plugin
« Reply #3 on: August 12, 2005, 08:19:29 pm »
I've updated snapshot, however there is nothing more interesting I can report yet.

One strange thing I found is that if codeblocks is being run from debuger, which cause it to be a litttle slower - I even have some seconds to play with code completion plugin before codeblocks crashes completely. Some new backtrace I was able to retrieve (don't know if it will help you):

Code: [Select]
Program received signal SIGABRT, Aborted.
[Switching to Thread -1225189696 (LWP 12338)]
0xb765c9e7 in raise () from /lib/tls/libc.so.6
(gdb) bt
#0  0xb765c9e7 in raise () from /lib/tls/libc.so.6
#1  0xb765e31b in abort () from /lib/tls/libc.so.6
#2  0xb7693365 in __fsetlocking () from /lib/tls/libc.so.6
#3  0xb769950c in malloc_usable_size () from /lib/tls/libc.so.6
#4  0xb769a5ab in free () from /lib/tls/libc.so.6
#5  0xb769bc4c in malloc () from /lib/tls/libc.so.6
#6  0xb765ed1f in qsort () from /lib/tls/libc.so.6
#7  0xb7d3fd57 in wxBaseArrayPtrVoid::Sort () from /usr/lib/libwx_gtk2-2.4.so
#8  0xb6a90753 in TokensArray::Sort () from /home/ruslan/workspace/codeblocks/src/output/share/CodeBlocks/plugins/libcodecompletion.so
#9  0xb6a8d1b3 in Parser::SortAllTokens () from /home/ruslan/workspace/codeblocks/src/output/share/CodeBlocks/plugins/libcodecompletion.so
#10 0xb6a88295 in NativeParser::MarkItemsByAI () from /home/ruslan/workspace/codeblocks/src/output/share/CodeBlocks/plugins/libcodecompletion.so
#11 0xb6a7f5ce in CodeCompletion::CodeComplete () from /home/ruslan/workspace/codeblocks/src/output/share/CodeBlocks/plugins/libcodecompletion.so
#12 0xb6a8041c in CodeCompletion::DoCodeComplete () from /home/ruslan/workspace/codeblocks/src/output/share/CodeBlocks/plugins/libcodecompletion.so
#13 0xb6a80b78 in CodeCompletion::OnCodeComplete () from /home/ruslan/workspace/codeblocks/src/output/share/CodeBlocks/plugins/libcodecompletion.so
#14 0xb7d46f05 in wxEvtHandler::SearchEventTable () from /usr/lib/libwx_gtk2-2.4.so
#15 0xb7d46cfc in wxEvtHandler::ProcessEvent () from /usr/lib/libwx_gtk2-2.4.so
#16 0xb7a88844 in PluginManager::NotifyPlugins () from /home/ruslan/workspace/codeblocks/src/output/libcodeblocks.so
#17 0xb7a1a658 in cbEditor::NotifyPlugins () from /home/ruslan/workspace/codeblocks/src/output/libcodeblocks.so
#18 0xb7a1d048 in cbEditor::DoAskForCodeCompletion () from /home/ruslan/workspace/codeblocks/src/output/libcodeblocks.so
#19 0xb7a21f0c in cbEditor::OnTimer () from /home/ruslan/workspace/codeblocks/src/output/libcodeblocks.so
#20 0xb7d46f05 in wxEvtHandler::SearchEventTable () from /usr/lib/libwx_gtk2-2.4.so
#21 0xb7d46cfc in wxEvtHandler::ProcessEvent () from /usr/lib/libwx_gtk2-2.4.so
#22 0xb7dc5075 in wxTimerBase::Notify () from /usr/lib/libwx_gtk2-2.4.so
#23 0xb7d07654 in timeout_callback () from /usr/lib/libwx_gtk2-2.4.so
#24 0xb71b67d4 in g_main_context_wakeup () from /usr/lib/libglib-2.0.so.0
#25 0xb71b4a21 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#26 0xb71b7c77 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#27 0xb71b81c8 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#28 0xb7486849 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#29 0xb7cc0896 in wxApp::MainLoop () from /usr/lib/libwx_gtk2-2.4.so
#30 0xb7d14ecf in wxAppBase::OnRun () from /usr/lib/libwx_gtk2-2.4.so
#31 0xb7cc1240 in wxEntry () from /usr/lib/libwx_gtk2-2.4.so
#32 0x08057c32 in ?? ()
#33 0xb7647ec0 in __libc_start_main () from /lib/tls/libc.so.6
#34 0x08057af1 in ?? ()

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Memleak fixed in code completion plugin
« Reply #4 on: August 12, 2005, 08:33:52 pm »
Hmm... very interesting. However this is a SIGABRT (abort) and not a SIGSEGV (segmentation fault).

Offline CleverFool

  • Single posting newcomer
  • *
  • Posts: 7
Re: Memleak fixed in code completion plugin
« Reply #5 on: August 12, 2005, 11:23:53 pm »
 :oops: Could it be that I tried to exit program after it hanged... Now in the same place I'm receiving dumb errors without any usable information. I suppose I'll tjust ry to debug it step by step...

Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1224710464 (LWP 15137)]
0xb770f3bf in free () from /lib/tls/libc.so.6
(gdb) bt
#0  0xb770f3bf in free () from /lib/tls/libc.so.6
#1  0xb7710c4c in malloc () from /lib/tls/libc.so.6
#2  0xb72302ea in g_malloc () from /usr/lib/libglib-2.0.so.0
#3  0xb72dbc50 in pango_attr_list_new () from /usr/lib/libpango-1.0.so.0
#4  0xb72e5ccc in pango_layout_get_pixel_size () from /usr/lib/libpango-1.0.so.0
#5  0xb72e5e58 in pango_layout_get_pixel_size () from /usr/lib/libpango-1.0.so.0
#6  0xb72e7d6e in pango_layout_get_iter () from /usr/lib/libpango-1.0.so.0
#7  0xb72eab4f in pango_renderer_draw_layout () from /usr/lib/libpango-1.0.so.0
#8  0xb738aa65 in gdk_draw_layout_with_colors () from /usr/lib/libgdk-x11-2.0.so.0
#9  0xb738abc5 in gdk_draw_layout () from /usr/lib/libgdk-x11-2.0.so.0
#10 0xb7d4e694 in wxWindowDC::DoDrawText () from /usr/lib/libwx_gtk2-2.4.so
#11 0xb792f0d7 in SurfaceImpl::DrawTextTransparent () from /usr/lib/libwx_gtk2_stc-2.4.so
#12 0xb794e801 in Editor::DrawLine () from /usr/lib/libwx_gtk2_stc-2.4.so
#13 0xb79590dd in Editor::Paint () from /usr/lib/libwx_gtk2_stc-2.4.so
#14 0xb7934147 in ScintillaWX::DoPaint () from /usr/lib/libwx_gtk2_stc-2.4.so
#15 0xb793bec2 in wxStyledTextCtrl::OnPaint () from /usr/lib/libwx_gtk2_stc-2.4.so
#16 0xb7dbbf05 in wxEvtHandler::SearchEventTable () from /usr/lib/libwx_gtk2-2.4.so
#17 0xb7dbbcfc in wxEvtHandler::ProcessEvent () from /usr/lib/libwx_gtk2-2.4.so
#18 0xb7d88cba in wxWindow::GtkSendPaintEvents () from /usr/lib/libwx_gtk2-2.4.so
#19 0xb7d88e53 in gtk_window_expose_callback () from /usr/lib/libwx_gtk2-2.4.so
#20 0xb74fdc7a in _gtk_marshal_BOOLEAN__BOXED () from /usr/lib/libgtk-x11-2.0.so.0
#21 0xb729ccce in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#22 0xb72ac15d in g_signal_stop_emission () from /usr/lib/libgobject-2.0.so.0
#23 0xb72ad3a5 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#24 0xb72ad99e in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#25 0xb75db4d8 in gtk_widget_activate () from /usr/lib/libgtk-x11-2.0.so.0
#26 0xb74fc821 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#27 0xb7399b1c in gdk_window_clear_area_e () from /usr/lib/libgdk-x11-2.0.so.0
#28 0xb7399c1c in gdk_window_process_all_updates () from /usr/lib/libgdk-x11-2.0.so.0
#29 0xb7399cc4 in gdk_window_process_all_updates () from /usr/lib/libgdk-x11-2.0.so.0
#30 0xb722bf61 in g_child_watch_add () from /usr/lib/libglib-2.0.so.0
#31 0xb7229a21 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#32 0xb722cc77 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#33 0xb722d1c8 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#34 0xb74fb849 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#35 0xb7d35896 in wxApp::MainLoop () from /usr/lib/libwx_gtk2-2.4.so
#36 0xb7d89ecf in wxAppBase::OnRun () from /usr/lib/libwx_gtk2-2.4.so
#37 0xb7d36240 in wxEntry () from /usr/lib/libwx_gtk2-2.4.so
#38 0x08057c32 in ?? ()
#39 0xb76bcec0 in __libc_start_main () from /lib/tls/libc.so.6
#40 0x08057af1 in ?? ()

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Memleak fixed in code completion plugin
« Reply #6 on: August 13, 2005, 12:08:18 am »
It hanged? :( noooooooooo

Those errors are nearly impossible to trace! :'(

OK. Let's do this. Get rid of the codecompletion plugin :P and, try to report all crashes, hangs etc.

When we fix them, and no "non-codecompletion" bug is found, we can be sure that all the other bugs are codecomplete's fault! :D

Offline CleverFool

  • Single posting newcomer
  • *
  • Posts: 7
Re: Memleak fixed in code completion plugin
« Reply #7 on: August 13, 2005, 01:33:30 am »
This hanging was my fault:) I havent found any non-codecomplete bugs yet, but I'm very interested in codecomplete one:) Now trying to localize it - when I comment this line "m_Parser.ParseBuffer(g_SampleClasses, true);" in ccoptionsdlg.cpp - plugin options dialog works. Ok... I'm finished with flooding here for now:) Sorry for disturbance:)