Hi Nikhil -

Thanks for the bug report. In this case, I think it's a minor issue,
since it appears that the leak is limited to these conditions:

 * tuple unpacked in call (as you noted)
 * tuple unpacked into global variables (i.e. not in a function)

In other words, this code doesn't seem to have the issue:

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

proc foo() {
  var (a1,a2) = mkarray();
  writeln("Done");
}

foo();



In any case I think it would be appropriate to file a .future about
this case. Are you interested in doing that?

Thanks,

-michael

On 3/29/16, 10:33 PM, "Nikhil Padmanabhan" <[email protected]>
wrote:

>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