Help, i need more memory from the heap!!!

L

laclac01

I am developing on windows XP professional, with 512 Megs of ram,
writing a console program in MSVC++ 6.0. I am writing a program that
processes very large matrixes. I am using a library that to do all the
matrix manipulations. But unfortunately at some point in my program
the matrixes are so large that I run out of memory.(I get an error
saying unable to allocate anymore memory) For what I am doing, I
can't break the matrixes down; they have to be kept as is. So my
question is there a way I can increase the size of the heap that is
given to me by windows? I am assuming windows allocates X amount of
memory for me to be able to use.
 
V

Victor Bazarov

I am developing on windows XP professional, with 512 Megs of ram,
writing a console program in MSVC++ 6.0. I am writing a program that
processes very large matrixes. I am using a library that to do all the
matrix manipulations. But unfortunately at some point in my program
the matrixes are so large that I run out of memory.(I get an error
saying unable to allocate anymore memory) For what I am doing, I
can't break the matrixes down; they have to be kept as is. So my
question is there a way I can increase the size of the heap that is
given to me by windows? I am assuming windows allocates X amount of
memory for me to be able to use.

Please ask platform-specific questions in newsgroups for the respective
platforms. 'comp.os.ms-windows.programmer.win32' is what you need for
this particular inquiry.
 
F

Frank Chang

I am curious how you are allocating memory for your matrix. Are you
using a
double** matrix member variable where the pointer to pointer allows you
to first, allocate memory to a pointer to the row and second,
allocate memory for the columns in each row?

But the most important thing I have found when I came across this
problem is to try to exploit the symmetry in your matrix to reduce the
actual number of memory elements you have to allocate memory for.
Also, please try using linear algebra algorithms to process smaller
chunks of your matrix at one time. Then , at the end , you can
aggregate the results from each processing each chunk of the matrix.
This is sometimes done in digital signal processing.
 
F

Frank Chang

In addition, if you can't really decompose your matrix using LA (don't
forget there is a ton of research out there which addresses your very
problem. The answer you get may not be perfect but an approximation)
why are you constrained to 512 MB. RAM Is relatively inexpensive and
you can expand to 2GB RAM with Windows XP.
The vast majority of matrices have symmetry. You just have to look
real hard to find it.
Finally, Microsoft has recently come out with a 64 bit version of
Windows 2003 . That should give you a lot more memory to use for your
problem. The problem is that 32 bit Windows software will not
automatically port to 64 bit Windows machines.
 
L

laclac01

I am using a library from C/math tool chest. It does complex numbers.
Is there a library you can recomend other than this one? This one is
kind of old.
 
F

Frank Chang

lacla...., Sorry I don't even know your first name. Here is a Matrix
class that I just wrote. Is this what you are using for your matrix?

class Matrix
{
private:
int rows;
int columns;
double **m;

public:
class Matrix1D{
public:
Matrix1D(int row, Matrix& matrix)
: id(row),
aMatrix(matrix)
{}

double& operator[](int index)
{
return aMatrix.m[id][index];
}

~Matrix1D()
{
//some stufff
}

private:
int id;
Matrix& aMatrix;
};

Matrix(int i, int j)
: rows(i), columns(j)
{
m = new double*[rows];
for (int r = 0; r < rows; r++)
m[r] = new double[columns];
for (int u = 0; u < rows; u++)
{
for (int v = 0; v < columns; v++)
m[v] = 0.0;
}
}


Matrix(const Matrix& theMatrix)
{
for (int i = 0; i < theMatrix.rows; i++)
delete [] m;
delete [] m;

m = new double*[theMatrix.rows];
for (int ii = 0; ii < theMatrix.rows; ii++)
m[ii] = new double[theMatrix.columns];

for (int jj = 0; jj < theMatrix.rows; jj++)
{
for (int kk = 0; kk < theMatrix.columns; kk++)
m[jj][kk] = theMatrix.m[jj][kk];
}
}


~Matrix()
{
for (int k = 0; k < rows; k++)
delete [] m[k];
delete [] m;
}

Matrix1D operator[](int row)
{ return Matrix1D(row, const_cast<Matrix&>(*this)); }

friend class Matrix1D;
};

As for your question about the Complex library, maybe you can find the
answer if you post in another newsgroup, as Victor Bazarov suggested.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top