Re: memory leaks in phobos?

2013-04-11 Thread Andrey
On Thursday, 11 April 2013 at 06:39:53 UTC, Traveler wrote: On 64 bit may cause crash: arr.length = length, fixed in next version. arr.length = 0; // must be deallocation? Not necessarily. You can manually do a garbage collection. The manual calling function GC.collect() has no effect (te

Re: Range returning an array

2013-04-11 Thread Joseph Rushton Wakeling
On 04/10/2013 01:18 AM, Steven Schveighoffer wrote: > Calling front after empty is not good range policy, once empty, front is > possibly invalid or points at invalid memory. It's not necessarily required to actually call front with the range empty: one could do something like, for(; !sim

Re: Range returning an array

2013-04-11 Thread Joseph Rushton Wakeling
On 04/10/2013 08:22 PM, Jesse Phillips wrote: > I'm pretty sure he realizes this, his original code shows how he is doing > this. > He expects 'output' to hold the final front value, but instead it holds the > empty "value." > > Joseph, I think you will have to profile to decide which is the fast

Re: memory leaks in phobos?

2013-04-11 Thread Ali Çehreli
On 04/10/2013 10:04 PM, Andrey wrote:> Hello! > int arr[]; > int length = 100_000_000; > for (int i=0; i<10; i++) > { > arr.length = length; // always new memory blocks, why? The slice does not know what other slices may be sharing the same elements. So, increasing