You are kind of close to the memory limit. On CF, try that you dont exceed 4.5*{10}^{6} total size of arrays.

3*{10}^{6} size arrays take 100MB there.

Now coming to your problem.

Your struct sqrts has 8 parameters, out of which 1 is string of length N and other is another struct with ~32 more variables (counting the child[28] as 28 variables).

Thats around 40 variables and a string of size N per sqrt thing. It seems you are making \sqrt{N} such structures. That becomes 40N\sqrt{N} , and in my opinion the constant is a bit too high.