Hi Greg - See below. Class instances have to be delete'd...
On 5/28/15, 11:41 AM, "Greg Kreider" <[email protected]> wrote: > >> I think you're already on the trail of the "Killed" problem > >Hi Greg, > >It's definitely an Out of Memory error, and I think a leak within >Chapel. > >Here's a test case similar to what was triggering the problem: > > class tst { > var Lalloc : domain(rank=1) = 1..2000; > var data1 : [Lalloc] int; > var data2 : [Lalloc] int; > } > > proc eat_memory(ind : int, val : int) { > var mem = new tst(); > > mem.data1(ind) = val; > mem.data2(val) = ind; > } > > for i in 1..500 { > for j in 1..1500 { > eat_memory(i, j); > } > } > >The arrays in the class don't seem to be freed when the procedure >is done with them (if the class is even freed). Since you allocated a class instance with new tst(), you also have to delete it. For example, you could have: proc eat_memory(ind : int, val : int) { var mem = new tst(); mem.data1(ind) = val; mem.data2(val) = ind; delete mem; } The point is that right now, class instances in Chapel must be delete'd by the program (or else they are leaked or cleanup up on program exit). Please see my other email for more discussion of our current work in improving the situation - and let's start a new thread if you want to talk about the longer-term strategy re. garbage collection. Thanks, -michael ------------------------------------------------------------------------------ _______________________________________________ Chapel-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/chapel-users
