[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linrad] Re: Memory leakage.



Leif

I cant speak as an accomplished programmer, having only done simple projects in C++
Still the code seems to be part of a routine. It looks like

cross_cursor is an object of class XCreateFontCursor

Maybe this is not being destroyed after use?

I havent the faintest how you would find the class code for this
X11 on my machine appears to be all C, though I cant locate source - I have just loaded Mandrake from a CD
No doubt there are more accomplished programmers who could advise..

Richard


Leif Asbrink wrote:

Hello Richard,

Lost memory is allocated when an object in C++ is created , but not released when the object is destroyed. This is usually performed by the destructor for the class if the class has been written properly.
???????????????
I have seen similar text before, but it does not tell me anything
at all. I have for example this problem. Only four simple statements:

xdis = XOpenDisplay(":0");
cross_cursor = XCreateFontCursor(xdis, XC_diamond_cross);
XFreeCursor(xdis, cross_cursor);
XCloseDisplay(xdis);
return 0;

If I comment out the second and the third statement all is ok,
but with both of them in place I get this report from valgrind:
==9031== LEAK SUMMARY:
==9031==    definitely lost: 8 bytes in 1 blocks.
==9031==    indirectly lost: 104 bytes in 4 blocks.

This results in increasing useless RAM utilization and eventually disk swapping, slowing everything down.
How can I detect whether it happened?
(hope I am not telling you things you already know.. :)  )
You told things I kind of heard about but that I do not
understand how to deal with. Did I make a mistake in the
example above or is X11 not quite ok yet? Do you know?
Using pthreads is much worse..............

73

Leif


#############################################################
This message is sent to you because you are subscribed to
 the mailing list <linrad@xxxxxxxxxxxxxxxxxxxxx>.
To unsubscribe, E-mail to: <linrad-off@xxxxxxxxxxxxxxxxxxxxx>
To switch to the DIGEST mode, E-mail to <linrad-digest@xxxxxxxxxxxxxxxxxxxxx>
To switch to the INDEX mode, E-mail to <linrad-index@xxxxxxxxxxxxxxxxxxxxx>
Send administrative queries to  <linrad-request@xxxxxxxxxxxxxxxxxxxxx>


#############################################################
This message is sent to you because you are subscribed to
 the mailing list <linrad@xxxxxxxxxxxxxxxxxxxxx>.
To unsubscribe, E-mail to: <linrad-off@xxxxxxxxxxxxxxxxxxxxx>
To switch to the DIGEST mode, E-mail to <linrad-digest@xxxxxxxxxxxxxxxxxxxxx>
To switch to the INDEX mode, E-mail to <linrad-index@xxxxxxxxxxxxxxxxxxxxx>
Send administrative queries to  <linrad-request@xxxxxxxxxxxxxxxxxxxxx>

LINRADDARNIL