Exception caused by calling a pure function repeatedly
    Joseph Rushton Wakeling 
    joseph.wakeling at webdrake.net
       
    Wed May 30 09:40:02 PDT 2012
    
    
  
On Wednesday, 30 May 2012 at 06:06:10 UTC, Ali Çehreli wrote:
> pure int[] solve(const bool[] redundancy, const ushort[LEN - 
> 1][] matrixes, const int[2^^LEN] bits, const int[] numbers)
>
> Fixed-length arrays are value types and are copied on the 
> stack. Try passing 'bits' as 'const ref' instead of just 
> 'const'.
This is specifically a fixed-length array issue?
I ask because I have a function in code I've written,
     final pure nothrow const(CoDetResult) reputation(immutable 
size_t users, immutable size_t objects, const Rating!(UserID, 
ObjectID, Reputation)[] ratings)
... which repeatedly gets passed vectors of length 4,000,000 or 
more, and memory usage stays at a constant level.
I didn't even realize it was possible to specify a fixed length 
for an array in a function declaration.
    
    
More information about the Digitalmars-d-learn
mailing list