Hi,

I'm spotting a memory leak when I return a tuple of arrays, and attempt to
unpack the tuple in the calling statement. An test code is below... If I
replace the var (a1,a2)= .... statement in the code below with var a1 =,
the memory leak goes away.

I'm not sure if I'm not allowed to unpack a tuple as I'm doing (but the
compiler certainly lets me do it). This is, of course, easy to work
around....

Thanks in advance!
-- Nikhil


Specifically, consider the following Chapel code :

config const N=128;
const Ntot=N**3;
proc mkarray() {
  var pos : [0.. #Ntot] real;
  var vel : [0.. #Ntot] real;
  return (pos, vel);
}
var (a1,a2) = mkarray();

writeln("Done");

compiled as :
   chpl -o tes_memleakt.x test_memleak.chpl

run as :
   ./test_memleak.x  --memTrack=true --memStats=true --memLeaks

I get...
Done

=================
Memory Statistics
==============================================================
Current Allocated Memory               33554944
Maximum Simultaneous Allocated Memory  67110280
Total Allocated Memory                 100665032
Total Freed Memory                     67110088
==============================================================

=================================================================================================================
Allocated Memory (Bytes)         Number   Size     Total    Description
                 Address
=================================================================================================================
test_memleak.chpl:7              1        136      136
 [domain(1,int(64),false)] real(64)0x00007f5c6962d280
test_memleak.chpl:7              1        136      136
 [domain(1,int(64),false)] real(64)0x00007f5c6962d320
test_memleak.chpl:7              2097152  8        16777216 array elements
                  0x00007f5c5ee00000
test_memleak.chpl:7              2097152  8        16777216 array elements
                  0x00007f5c5de00000
test_memleak.chpl:5              1        96       96
domain(1,int(64),false)          0x00007f5c6962a180
test_memleak.chpl:6              1        96       96
domain(1,int(64),false)          0x00007f5c6962a1e0
test_memleak.chpl:7              1        24       24
listNode(BaseArr)                0x00007f5c69619d80
test_memleak.chpl:7              1        24       24
listNode(BaseArr)                0x00007f5c69619d60
=================================================================================================================



---------------------------------
Nikhil Padmanabhan
[email protected]
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to