Hi,
I've been trying to figure out why I'm getting a valgrind error about memory
leakage from my simple program (below). I don't know if this error results
from what is being discussed in the "FL Window memory leak" emails just a few
days ago, or is it something different. I ran some of the 'test' programs
povided with the fltk package, and get the same, or worse, memory leak errors.
What's going on? Do I need to subclass Window, and try to apply some sort of
fix before I can use it? Or, is valgrind giving me a fictitious error. Or , is
this a bug?
Please help. I've spent several days trying to figure this out, and I just
seem to be sinking. I admit that I'm new to gui programming, and this is way
over my progamming classes, but shouldn't a rudimentary program (below) not
produce memory problems?
Thanks,
Marty
marty moore <[EMAIL PROTECTED]> wrote: Hi,
I'm updating my own message as I attempt to research my question. I have tried
simplifying my test to a very basic main.cxx file that creates a window, which
I then close by clicking the close button ( default_callback). Valgrind still
gives me a 45 byte lost memory error. I've tried several ideas to try and fix
the valgrind error, but can't come up with a solution. Is this a real memory
leak, or is everything OK?
Has anyone have and ideas?
I'm running enterprise linus 2.6.9-55 on a x86_64 box. gnome, and emacs
21.3-19, gcc 3.4.6-8
thanks,
Marty
Here's the program:
int main(int argc, char *argv[])
{
cout << "main: 1" << endl;
Window win( 100, 100, 0);
win.show();
cout << "main: 2" << endl;
int ret = fltk::run();
win.destroy();
return ret;
}
here's the valgrind error report:
[EMAIL PROTECTED] --leak-check=yes ./x
==6948== Memcheck, a memory error detector.
==6948== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==6948== Using LibVEX rev 1732, a library for dynamic binary translation.
==6948== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==6948== Using valgrind-3.2.3, a dynamic binary instrumentation framework.
==6948== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==6948== For more details, rerun with: -v
==6948==
main: 1
main: 2
==6948== Syscall param write(buf) points to uninitialised byte(s)
==6948== at 0x3291B0B0D2: __write_nocancel (in
/lib64/tls/libpthread-2.3.4.so)
==6948== by 0x384FC5CC3E: (within /usr/X11R6/lib64/libX11.so.6.2)
==6948== by 0x384FC40448: (within /usr/X11R6/lib64/libX11.so.6.2)
==6948== by 0x384FC22C17: XFlush (in /usr/X11R6/lib64/libX11.so.6.2)
==6948== by 0x41023A: fltk::wait(float) (in /home/marty/fltk/g8/test/x)
==6948== by 0x410802: fltk::run() (in /home/marty/fltk/g8/test/x)
==6948== by 0x406B4E: main (main.cxx:19)
==6948== Address 0x4AAD910 is 240 bytes inside a block of size 16,384 alloc'd
==6948== at 0x490631D: calloc (vg_replace_malloc.c:279)
==6948== by 0x384FC303B0: XOpenDisplay (in /usr/X11R6/lib64/libX11.so.6.2)
==6948== by 0x40AED6: fltk::open_display() (in /home/marty/fltk/g8/test/x)
==6948== by 0x415099: fltk::Window::show() (in /home/marty/fltk/g8/test/x)
==6948== by 0x406B2D: main (main.cxx:16)
==6948==
==6948== Source and destination overlap in mempcpy(0x7E21450, 0x7E21450, 27)
==6948== at 0x4907A30: mempcpy (mc_replace_strmem.c:116)
==6948== by 0x3290E66597: _IO_default_xsputn (in /lib64/tls/libc-2.3.4.so)
==6948== by 0x3290E42DF6: vfprintf (in /lib64/tls/libc-2.3.4.so)
==6948== by 0x3290E5D118: vsprintf (in /lib64/tls/libc-2.3.4.so)
==6948== by 0x3290E483D5: sprintf (in /lib64/tls/libc-2.3.4.so)
==6948== by 0x7EA3192: (within
/usr/X11R6/lib/X11/locale/lib64/common/xomGeneric.so.2)
==6948== by 0x7EA32ED: (within
/usr/X11R6/lib/X11/locale/lib64/common/xomGeneric.so.2)
==6948== by 0x7EA3F7A: (within
/usr/X11R6/lib/X11/locale/lib64/common/xomGeneric.so.2)
==6948== by 0x384FC5A1DB: XCreateOC (in /usr/X11R6/lib64/libX11.so.6.2)
==6948== by 0x384FC59065: XCreateFontSet (in /usr/X11R6/lib64/libX11.so.6.2)
==6948== by 0x40FA5D: fltk::handle() (in /home/marty/fltk/g8/test/x)
==6948== by 0x4101BA: do_queued_events(int, void*) (in
/home/marty/fltk/g8/test/x)
==6948==
==6948== ERROR SUMMARY: 20 errors from 2 contexts (suppressed: 8 from 2)
==6948== malloc/free: in use at exit: 999,002 bytes in 25,954 blocks.
==6948== malloc/free: 45,536 allocs, 19,582 frees, 3,125,900 bytes allocated.
==6948== For counts of detected errors, rerun with: -v
==6948== searching for pointers to 25,954 not-freed blocks.
==6948== checked 3,246,336 bytes.
==6948==
==6948==
==6948== 45 (16 direct, 29 indirect) bytes in 1 blocks are definitely lost in
loss record 33 of 160
==6948== at 0x4904D9E: malloc (vg_replace_malloc.c:149)
==6948== by 0x384FC590AD: XCreateFontSet (in /usr/X11R6/lib64/libX11.so.6.2)
==6948== by 0x40FA5D: fltk::handle() (in /home/marty/fltk/g8/test/x)
==6948== by 0x4101BA: do_queued_events(int, void*) (in
/home/marty/fltk/g8/test/x)
==6948== by 0x410685: fltk::wait(float) (in /home/marty/fltk/g8/test/x)
==6948== by 0x410802: fltk::run() (in /home/marty/fltk/g8/test/x)
==6948== by 0x406B4E: main (main.cxx:19)
==6948==
==6948== LEAK SUMMARY:
==6948== definitely lost: 16 bytes in 1 blocks.
==6948== indirectly lost: 29 bytes in 1 blocks.
==6948== possibly lost: 0 bytes in 0 blocks.
==6948== still reachable: 998,957 bytes in 25,952 blocks.
==6948== suppressed: 0 bytes in 0 blocks.
==6948== Reachable blocks (those to which a pointer was found) are not shown.
==6948== To see them, rerun with: --leak-check=full --show-reachable=yes
[EMAIL PROTECTED]
---------------------------------
Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See
how._______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk
---------------------------------
Get easy, one-click access to your favorites. Make Yahoo! your homepage.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk
---------------------------------
Never miss a thing. Make Yahoo your homepage.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk