> What I would try to do is to increase the loop count. Are there
> significant differences in the LEAK SUMMARY? If yes (and there is
> no other programming error that causes it), then there *could* be
> a memory leak that's worth to be investigated.

        Yes, this was my thought as well.

        I tried David's program and changed the lCount to 100
        and got the same result as 3, so it's not leaking in the
        loop, which is good.

        I didn't see "memory growth", which is the main thing
        you're checking for when doing memory use checks on an app.

        However in the test program, it doesn't actually get to
        map the window; a call to Fl::wait(.1); before the delete
        should take care of that though, and would exercise a bit
        more code.

        I did this, and didn't see a leak in the loop there either,
        the windows flashing on and off.

        Also: my leak summary looks different than David's;
        mine shows 0 bytes for definitely lost/indirectly lost
        with the above example. That's with centos 5 / fltk-1.3.x-current

> there are
> examples that can show a big *unnecessary* slowdown when a program
> is stopped due to deleting all objects step-by-step instead of leaving
> this to the OS.

        Yes; I recall when Maya and I think Softimage used to try
        to call all destructors on exit, and File > Quit literally
        took a minute or two to run. Would take a split second
        if they had called _exit(0); instead of exit(0);

> If you really want to investigate, try to write a program that
> leaks memory w/o obvious (user) programming errors, and if you
> find one, please post here, so that we can investigate and fix
> possible errors. On Windows the task manager can show resources
> (you can configure many of them), or maybe sysinternals tools
> can even show more infos.

        I think David's using Debian (based on his valgrind output),
        so it'd be good to use either top(1) or ps(1) in a loop
        to watch the program's memory use while it runs.

        So to watch a program called 'hello', you could use:

while [ 1 ]; do ps -a -o rssize,vsize,cmd | grep hello | grep -v grep; sleep 5; 
done

        ..and watch if those two numbers at the left grow in size.

        If your version of ps(1) doesn't support the -o flag, then:

while [ 1 ]; do ps auxww | egrep 'hello|PID' | grep -v grep; sleep 5; done

        ..and keep an eye on the VSZ/RSS values for growth.
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to