[FreeNX-kNX] Memory leak in nxagent, with patch

Dimitar Paskov pascoff at nola7.com
Thu Feb 22 14:14:46 UTC 2007


Hi, I have the same problem and the worst part is that it affects not only the 
nxagent but the X server where the nxclient is started ... the problem is 
that I use NX with thin clients with 128MB RAM which is not enough. This 
problem occurs when viewing graphics - pictures, photos, scanned files, 
anything that has an image ... I think it is something with caching images 
from applications running inside nxagent, which caches this images and sends 
them through nxclient to the X server where the client is started. When this 
cache becomes bigger than the available memory on the client side (thin 
client) the X server crashes ... the problem continues when you try to resume 
the session (which is alive on the server) and the cached stuff from 
nxagent "returns" to the client and fills the whole memory again ... 
to fix this you have to kill nxagent or the application from which it caches 
images ... I'm not sure if it's a memory leak or it is designed to work like 
that, may be its a X server problem ...

> Due to having long sessions, I've been afflicted by memory leaks in
> nxagent. Such leaks can be visually seen at:
> http://img57.imageshack.us/img57/3018/memorymonthbl4.png
> The green area, representing total application memory usage for the
> whole system, illustrates the leaks: nxagent would go from 30MB
> resident to 200+, until I'd finally get pissed off and would restart
> the session.
>
> I finally decided to do something about it. The attached patch fixes
> those memory leaks. Note that not all leaks are fixed. Essentially all
> of the others (that my workload triggers) are in initialisation code,
> so they only occur once, and, therefor, have less impact.
>
> The patch should apply cleanly against nxagent-2.1.0-18, currently the
> latest available from the NoMachines's source page
> (http://www.nomachine.com/sources.php)
>
> The main leak is in nxagentSynchronizeRegion, so it probably affects
> most workloads.
>
> Anik
>
> PS: this leak fix was facilitated by valgrind. If you're a C/C++
> developer/maintainer and have never looked into it, you should.



More information about the FreeNX-kNX mailing list