|
[Sponsors] |
April 12, 2020, 01:46 |
delete pointer of scalar in OpenFOAM
|
#1 |
Senior Member
Mehdi Babamehdi
Join Date: Jan 2011
Posts: 158
Rep Power: 15 |
I created dynamic arrays of scalar in openfoam like this
Code:
int num = 10; scalar myScalar = new scalar[num]; and then I want to delete the pointer of array like this Code:
delete[] myScalar; but it seems for scalar class, delete operator has not been defined. So my question is how I should delete pointer of array to prevent memory leak. |
|
April 13, 2020, 11:09 |
|
#2 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66 |
To call delete you normally would need to allocate it using something like:
Code:
scalar *myScalar = new scalar[num]; Or does that not fix the issue? |
|
Tags |
delete, memory leak, openfoam, scalar array |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Map of the OpenFOAM Forum - Understanding where to post your questions! | wyldckat | OpenFOAM | 10 | September 2, 2021 06:29 |
OpenFOAM course for beginners | Jibran | OpenFOAM Announcements from Other Sources | 2 | November 4, 2019 09:51 |
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 | cfd.direct | OpenFOAM Announcements from Other Sources | 2 | August 31, 2015 14:36 |
New OpenFOAM Forum Structure | jola | OpenFOAM | 2 | October 19, 2011 07:55 |
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 | wyldckat | OpenFOAM Announcements from Other Sources | 3 | September 8, 2010 07:25 |