View previous topic :: View next topic |
Author |
Message |
GG
Joined: 05 Nov 2009 Posts: 18
|
Posted: Thu Nov 05, 2009 8:22 pm Post subject: Memory leak in TextView ? |
|
|
Hello,
I'm using dmd2 and GtkD1.2.
I have a question about TextView and TextBuffer. In "demos" folder of Gtkd, I found a project demo named TestWindow. It's realy good to understand how to create DUI program. But in tab "gtk-demo" of the main application, there is a textView button. When I click the button, a new window open with the text and the memory increase a little. If I close this popup window, the memory doesn't free and stay in heap. If I open the window with textview many times, the memory is never free.
I wrote a test program and I got the same problem.
Is there a solution for this ?
Thanks. |
|
Back to top |
|
|
Mike Wey
Joined: 07 May 2007 Posts: 428
|
Posted: Fri Nov 06, 2009 2:59 pm Post subject: |
|
|
I can see the same behavior with the dome, i don't have a solution though. |
|
Back to top |
|
|
GG
Joined: 05 Nov 2009 Posts: 18
|
Posted: Mon Nov 09, 2009 10:27 am Post subject: |
|
|
I found this http://library.gnome.org/devel/gtk/unstable/gtk-question-index.html.
In section 1.5, it explain why we can get memory leak with object.
I tried apply "doref" and "unref" as they said, but memory is never free.
I tried another test, if I read a file of 2mb with "std.file.read" and put it in a textView, memory increase of 2mb. Then after closing textView popup, if I read another file of 2mb, memory stay the same. But if I read after that a file of 5mb, memory increase.
Maybe "doref", "unref", "sink", "destroy" ... can help, but it doesn't work for me or I don't understand how to apply unref on widget.
Thanks. |
|
Back to top |
|
|
Mike Wey
Joined: 07 May 2007 Posts: 428
|
Posted: Mon Nov 09, 2009 3:52 pm Post subject: |
|
|
You could try running the GC after you destroy the GTK object. |
|
Back to top |
|
|
GG
Joined: 05 Nov 2009 Posts: 18
|
Posted: Thu Nov 12, 2009 3:08 pm Post subject: |
|
|
Mmm no result with GC.collect(),
I tried all solutions possible to put unref, doref, sink, destroy but no result, I continue to seek.
Just to be sure, std.file.read will close the handler on the file itself ? I fear that the file read is never close and free. Maybe...
Anyway, the sample TestWindow in "demos" folder of GtkD has a problem with memory and not use any std.file.read, so the problem is somewhere else in textBuffer or textView.
Thanks. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|