CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Memory Leakage

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 24, 2016, 13:16
Post Memory Leakage
  #1
New Member
 
Marco
Join Date: Nov 2014
Location: Germany
Posts: 14
Rep Power: 11
mkiewat is on a distinguished road
Hi all,

I modified a function object to send volume field data to an external C function. I'm basically copying a field vector component to a scalarField variable, then I send a pointer, pointing to the C-data, to an external C++ function "CallScript".

Code:
const scalarField fCellValues = values.component(vector::X);
const double * const fieldVectorPtr = fCellValues.cdata();
const double response= mlObj.CallScript(mScriptFilename,nCellsPtr,fieldVectorPtr);
After a few time steps I'm experiencing a steady increase (each timestep) in memory on the master process until it runs out of memory and the simulation crashes. In the function object .C file, do I need to manually destroy the fCellValues, fieldVectorPtr and response variables after usage and how should I do that? Is there a better way than copying the data? I tried to just pass a pointer to values.component(vector::X), but after a short time, the data that the pointer points to is destroyed automatically and it can't be accessed within the external function anymore (the pointer version works for very small cases with a few cells only). Has anyone experienced the same type of trouble?
mkiewat is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Memory bandwidth and memory interleaving Sly Hardware 2 February 19, 2015 13:41
Solver error message - memory usage Jared1986 CFX 12 December 2, 2014 05:28
Run-time memory allocation error akalopsis CFX 0 November 17, 2014 17:17
Lenovo C30 memory configuration and discussions with Lenovo matthewe Hardware 3 October 17, 2013 10:23
CFX CPU time & real time Nick Strantzias CFX 8 July 23, 2006 17:50


All times are GMT -4. The time now is 19:19.