Because of science reasons I'm solving nine men's morris game. I'm trying to save information about some subset of games states. Unfortunately I reached my memory limit.
I have few very huge array. When new elements came I need to extend these arrays. I have sufficient memory to store these arrays, but I can't afford creating extended arrays where original array is still in memory.
I thought about saving original array to some file, removing it from memory, creating extended array and loading data to it from file.
Is there any fast way to save array size N
and load it as first N
elements to longer array? To this moment I was using BinaryFormatter
, but I don't know if I can use it here.
How can I tell GC
to remove original array from memory?