I have a question about memory usage when using MathLink and C++. Here is my setup:
(1) A dynamic user interface in Mathematica which displays positions of points (the points are stored in a list). (2) A C++ function that updates the position of the points. (3) The dynamic user interface calls the C++ function with a list of current point positions and the C++ function returns a list of updated positions.
The C++ function has no memory leaks (the process size remains constant throughout the simulation); however, the Mathematica process (Windows 7) memory usage keeps growing as the simulation runs. Here is the code which returns the C++ computation to Mathematica via MathLink.
The result is stored in a List in Mathematica, i.e., result = Simulate[....]. The points' positions then dynamically updated in a visualization. I am using Mathematica version 8.0.4 in Windows 7 and the MathLink code is a 64-bit executable built with Visual Studio 2010.