[Haskell-beginners] CAF taking all the memory
mdibaiee at aol.com
Mon May 2 18:55:20 UTC 2016
I’m pretty new to Haskell and I’m trying to write a Neural Network in Haskell for educational purposes.
So, I have my neural network working, it can learn XOR in 500 iterations, but the thing is, if I increase the iterations to something like 5 milion times,
the process just drains my RAM until either it’s killed or the OS drowns. Here is the code: 
I searched online and tried to get information on why this is happening, I profiled the memory usage and found that the memory is taken by CAF, searching online,
it seems like an optimization done by compiler to reduce runtime computations. Here is the profile: 
I searched online on how to prevent this from happening, couldn’t find anything helpful.
I found this  and tried the workaround, but it didn’t work.
Is there any way to solve this problem? Because when I’m moving to more complex problems, I have to train with much more iterations, and it just doesn’t work.
More information about the Beginners