M
macneed
i wrote a program that have a large size array, but the size is change often
(about 3 -4 mins)
the program like that:
public class MemoryArray
{
public float[,,] MM;
public MemoryArray(int Size)
{
MM = new float[Size, 10000, 10000];
}
}
static void Main(string[] args)
{
int[] SizeArray = { 100, 200, 300, 400 };
MemoryArray MA = new MemoryArray(1);
int i=0;
while (true)
{
MA = null; // I try to use it to release memory
GC.Collect();
MA = new MemoryArray(SizeArray[i++%4];
(about 3 -4 mins)
the program like that:
public class MemoryArray
{
public float[,,] MM;
public MemoryArray(int Size)
{
MM = new float[Size, 10000, 10000];
}
}
static void Main(string[] args)
{
int[] SizeArray = { 100, 200, 300, 400 };
MemoryArray MA = new MemoryArray(1);
int i=0;
while (true)
{
MA = null; // I try to use it to release memory
GC.Collect();
MA = new MemoryArray(SizeArray[i++%4];