Mainly you're running out of RAM memory.
You may have to modify your code to be able to run it. There are different ways of optimizing the code.
1- Reducing the number of variables. for instance, instead of creating new variables, use the already defined variables.
2- Define variables as single prevision single() or int32 or .... This is going to help a lot with big matrices! You just have to be careful if this is changing the precision of your process. (there is no point to assign a double to define a variable like 32, int is enough). This also may cause you some complications, as some operations only support double precision. (try this it's very effective)
3- Use sparse matrix if possible.
4- Close other applications that are using your PC's RAM.
These are all that I can think of. ATM