cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Memory allocation

ptc-6238348
1-Newbie

Memory allocation

I keep getting "Not enough Memory" when I run my program. I wonder if there is a way to increase the memory allocation for Mathcaad. Thanks

11 REPLIES 11

Rico Mayro Tanyag wrote:

I keep getting "Not enough Memory" when I run my program. I wonder if there is a way to increase the memory allocation for Mathcaad. Thanks

I guess you are using Mathcad 15 or below - right?

Unfortunately there is no way to increase the accessible memory.

Is the error message reasonable? Do you have to deal with lots of huge matrices?

There are some "tricks" which may help to preserve mem sometimes but we would have to see the sheet to determine.

What version of Mathcad do you use and what OS?

Hello Werner,

Thank you very much for the reply. I am using Mathcad 14.

I think the error is reasonable since we are doing about 200 interation on a 1000x1000 matrix.

I have disabled parts that are not needed.

I am running Matchcad on a Windows 7. I have no experience with the newer version of Mathcad.

Do you keep all steps of your iteration - that means, do you end up with 200 matrices? Unless you really need all steps it should be possible to do the same with just two matrices, maybe even just one.

Is the iteration done in a function? The memory of matrices created locally in a function is deallocated when the routine finishes. Memory of matrices defined (globally) in the sheet never is deallocoated - not even when the matrix (variable) is completely deleted.

I am using Mathcad 14.

...

I am running Matchcad on a Windows 7. I have no experience with the newer version of Mathcad.

Prime is a rather useless program in my opinion - missing a lot of the features available in MC15 or 14, is extremely slow and very uncomfortable.

But ... its available in 64bit flavor and so should be able to benefit from more memory in the machine. Furthermore there is a switch to make use of multiple processor cores, so it may speedup calculation in some cases. But Prime is generally slower - there was a thread here a while ago (http://communities.ptc.com/message/198425#198425) with the facit, that the speed of Prime with multicore on was approximately the speed of MC15 - but that sure depends much on the specific calculations done.

So despite in my opinion Prime is not a software to work with - because of the ability to use more memory it may be an option for you to testdrive Prime. The trial version is fully functional for 30 days and then falls back in a crippled "Express" mode.

You most likely would have to recreate you sheet from scratch for two reason:

1) Prime cannot read MC14 or MC15 files (and it cannot save back in older formats, too)

2) There is a converter to turn older files in Prime format, but it ever so often produces unuseable results. Furthermore this converter needs that the current MC15 is installed. If you install the MC15 trial it will deinstall your MC14 - you will have to save your license file first. When the MC15 trial period is over you will have to deinstall MC15, reinstall MC14 and provide the saved license file.

The iteration runs on a function and it only produces one matrix 1000 x 1000. The production of this matrix takes about 5-6 hours on a 4 GB RAM and Intel Core-i7. I don't get the error when producing this matrix, but any subsequent operation performed after is prone to the "not enough memory" error. To get around this problem, I've printed the matrix so I can open up a new Mathcad file and do the subsequent operation that I need.

Is it actually possible to produce the intermediate matrix? I've always thought that Mathcad can only produce the final one.

Thanks for discussing the pros and the cons of the using different versions of MathCad.

RichardJ
19-Tanzanite
(To:ptc-6238348)

The iteration runs on a function and it only produces one matrix 1000 x 1000.

You may well be right, but you may also be wrong. You would not be the first to get caught by what you think Mathcad is doing, vs. what it is actually doing. To clarify what Werner said, if at the worksheet level you type

A:=2

A:=A*2

The second A does not overwrite the first. You have two independent copies of A, and there is no way to subsequently free the memory used by either of them. I wrote simple expressions using only operators, but this is true regardless of how A is created or subsequently modified.

What happens in a program is rather different though. If you write inside a program:

A<--2,

then when the program exits the memory allocated to A is freed.

If you write

A<--2

A<--A*2

I forget whether the second A overwrites the first. I know it's been discussed in a previous thread, but I can't find it. I think the second A does in fact overwrite the first, but I'm not certain of that. Regardless, when the program exits the memory for all variables that are local to the program is freed.

Without seeing the worksheet it's impossible to say how this might be applied to your problem, but if you are having memory problems you should at least be aware of it.

Is it actually possible to produce the intermediate matrix? I've always thought that Mathcad can only produce the final one.

Mathcad will produce whatever you program as return value in your iteration function. You can nest matrices and vectors, so when each iteration step results in a matrix, you could put this matrix as element in a vector and do the same with the subsequent iteration steps. The return value of the routine would then be this vector consisting of a number of matrices. In your case this might not be the best idea, though, as you obviously are working on memory limits. Actually I wonder why because a 1000x1000 matrix is not that huge. You should be able to create quite a lot of them and do operation with. I just created 10 1000x1000 matrices with random values and by multiplying one with the other without any problems (and with just 1 GB of RAM).

But we sure would have to look at your sheet to be (hopefully) able to say where the memory is used up and what could possibly be done more memory efficient.

Hi,

Can you attach your worksheet for testing?

MikeArmstrong
5-Regular Member
(To:ptc-6238348)

There could be many reasons why your worksheet is running slow, but without seeing a worksheet it is possible to determine.

Please upload a sheet.

Mike Armstrong wrote:

There could be many reasons why your worksheet is running slow, but without seeing a worksheet it is possible to determine.

Rico's problem is not slow performance but worksheet failing because MC runs out of memory. I already stated in my first reply that we would have to see the sheet to see if there is a workaround.

But maybe the question was meant as it was posed and Rico just wanted to know if there is any hidden option to enable Mathcad to use more memory - the answer obviously was "no".

MikeArmstrong
5-Regular Member
(To:Werner_E)

Hopefully that will be one benefit of Prime in the future

Mike Armstrong wrote:

Hopefully that will be one benefit of Prime in the future

People doing only very basic calculations but with a lot of huge matrices may benefit from Prime's 64bit architecture already now.

Top Tags