To debug the nxserver program with Valgrind, please read here: https://www.nomachine.com/AR04P00976. This feature is available since v. 6.1.
While investigating problems related to high memory usage into the session, the Support Team could request to run the Valgrind memory debugger in the user's environment to detect possible memory leaks.
Instructions below assumes to run Valgrind on Linux.
The Valgrind debugger can be installed also on Mac OS.
To run Valgrind with NoMachine
1. Install the Valgrind tool if it's not already installed: http://valgrind.org/
2. Edit the node configuration:
3. Uncomment and set the following keys:
DebugOptions "--leak-check=full --show-reachable=yes --log-file=/tmp/nxnode.%p.out"
NOTES for 3.
i) Comma-separated list in AcceptedDebuggerCommands should not contain spaces!
ii) 'CommandDebug' points to the Valgrind launch script.
'AcceptedDebuggerCommands' points to the Valgrind binary(ies).
Be aware that paths and commands may vary on different Linux distributions. Values indicated above will work in most cases.
For exampe, depending on the operating system, the valgrind binary is named 'valgrind.bin' or 'valgrind'.
If the binary is 'valgrind.bin', set:
You can specify further binaries in a comma-separated list.
iii) Commands in 'AcceptedDebuggerCommands' can depend also on the architecture. For Linux 32 bit:
iv) In case of problems to run Valgrind, check also the /usr/NX/var/log/nxerror.log file. For example a message like:
ERROR: Not an NX application: '/usr/lib64/valgrind/memcheck-amd64-linux'.
indicates that the /usr/lib64/valgrind/memcheck-amd64-linux module should be adde to the 'AcceptedDebuggerCommands' key.
v) The Valgrind debugger can be installed also on Mac OS. Be sure to set appropriate values in the NoMachine 'CommandDebug' and 'AcceptedDebuggerCommands' configuration keys in order to fit your installation.
v) If it's requested by the Support Team to use the Massif tool heap profiler, change the DebugOptions key to have:
DebugOptions "--tool=massif --pages-as-heap=yes --massif-out-file=/tmp/nxnode.%p.massif.out"
4. Create a new session.
NOTE for 4.
Note that CPU and memory usage will increase considerably when session is run with the debugger enabled.
5. Operate inside the session until the problem of high memory usage occurs.
6. Terminate the session that has reached a high memory usage.
Note that disconnecting the session is not enough!
7. Send the /tmp/nxnode.<pid>.out file to the Support Team.
<pid> is the pid of the nxnode.bin process which is leaking memory
To not impact all users:
1) set EnableDebug key to 1.
2) start a new session (session A).
3) Reset EnableDebug key to 0.
4) Leave session A running until you reproduce the problem.
In this way only session A is running under Valgrind, all the other sessions will be unaffected .