The declaration of ArrayLiteralExp has an array of pointers pointing to each element of the array. If the pointer at a particular array index is null, then the basis field is used instead. This saves a great deal of memory for carrying around large array literals, that are mostly the same value (like 0).
Unfortunately, the function copyLiteralArray() in ctfeexpr.d fills the array with copies of basis. This can result in a great deal of memory consumption with large arrays.
The fix should be not allocating a copy if the basis has the same value in it.
This was brought up by Luis Ferreira of Weka.
The declaration of ArrayLiteralExp has an array of pointers pointing to each element of the array. If the pointer at a particular array index is
null, then thebasisfield is used instead. This saves a great deal of memory for carrying around large array literals, that are mostly the same value (like 0).Unfortunately, the function
copyLiteralArray()in ctfeexpr.d fills the array with copies ofbasis. This can result in a great deal of memory consumption with large arrays.The fix should be not allocating a copy if the
basishas the same value in it.This was brought up by Luis Ferreira of Weka.