Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11443

Question regarding MathLink memory use

From samid.hoda@gmail.com
Newsgroups comp.soft-sys.math.mathematica
Subject Question regarding MathLink memory use
Date 2012-08-22 06:25 +0000
Message-ID <k11u16$t8d$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


Hi,

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.

if (MLPutFunction(stdlink,"List" ,3)) {
               if     (!MLPutReal64Array(stdlink, pointTotalForces, dims, NULL, 2)) { /* Handle error ...*/ }
               else if (!MLPutReal64(stdlink, Sim.meanPointForceMagnitude)) { /* Handle error ...*/ }
               else if (!MLPutReal64(stdlink, Sim.maxPointForceMagnitude )){ /* Handle error ...*/  }
} else { /* Handle error ... */ }

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.

I would appreciate any suggestions.

Sam

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Question regarding MathLink memory use samid.hoda@gmail.com - 2012-08-22 06:25 +0000

csiph-web