Question: how to release memory for available 4GB memory in computer?

i have already release memory with gc() in the most inner for loop ]

,but it still use up my memory

once it printed two lines each time, actually it can release memory

but why it still use up memory

read "D:\\hello.m":
with(combinat):
appendto("D:\\gogogo.txt");
for ii from 1 to 2040 do
for jj from 1 to 2040 do
for kk from 1 to 2040 do
if ii < jj and jj < kk then
if mm[ii] <> mm[jj] and mm[jj] <> mm[kk] then
sol := dsolve([mm[ii],mm[jj],mm[kk]],[a(t),b(t),c(t)]);
print([mm[ii],mm[jj],mm[kk]]);
print(sol);
print("***");
end if:
end if:
od:
gc();
od:
od:

 

i can only think

use c# to generate code with file write, nested for loop every 1000 records 

is it the only way to do?

 

int counter = 0;
for (int i=1; i<=2040; ++i)
{
for (int j = 1;j <= 2040; ++j)
{
for (int k = 1; k <= 2040; ++k)
{
if(counter % 1000 == 0)
{
Console.Write(i.ToString() + ","+j.ToString() + ","+k.ToString());
Console.Write("\r\n");
}
counter = counter + 1;
}
}
}

 

Please Wait...