stack memory

andrews

Well-known member
Joined
Nov 22, 2011
Messages
167
Programming Experience
5-10
I have made a program who needs much memory depending the parameters I give.
I can run at the same time several of them approching the total memory.
But when I increase a little of the memory with the parameter I get a memory error with but 1 program by starting the program.
Maybe it is a question of the stack.
Can I change the code so that 1 program can take the whole free memory from the computer?
Thanks for any response
 
You'd be far better off all round changing the code so that it uses far less memory! Unless this is an application running a small country you really shouldn't be approaching memory problems!
 
Huh? This program assigns 10,000,001 variables with a very large number indeed and does a bit of useless math and runs at a tad over 85,000k of memory demand. I'm sorry but there is only one way that your program could be running into memory problems and that is that it is extremely badly coded.

Public Class Form1


Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim VeryLargeNumber As Int64 = 9223372036854775800
Dim SnaffleMemory(10000000) As Int64


For n = 1 To 10000000
SnaffleMemory(n) = VeryLargeNumber
VeryLargeNumber += 1
VeryLargeNumber -= 1
Next


End Sub




End Class
 
Sorry again but I think it is not my code who is bad (I see you are a newbie to:=)
The problem is :
For example (the numbers are but examples) my program needs 800Mb (and I know it needs!)
I can run on the same time 3 programs, this takes 2400Mb.
But when I run one time my program who needs this time 1000Mb I get a error.
That is the problem.
I guess it is a problem of the stack and I am afraid that nothing can help.
But where are the experts?
 
New to the forum is not the same as new to VB. The fact is that 800Mb is quite frankly an outrageous amount of memory but if you're happy with it .....
 
You'd be far better off all round changing the code so that it uses far less memory! Unless this is an application running a small country you really shouldn't be approaching memory problems!

Then, again, one COULD be doing Image Processing on a VERY LARGE .TIF image (say 8000 pixels wide by 11000 pixels high - at 200 DPI, in 24 bit color). While a tad SMALLER than a "small country", it FAR EXCEEDS the 1MB stack space (don't you think?)!

To suggest that NO ONE should have any need for more than 1MB of stack space, is like Bill Gates asserting the NO ONE would need more than 640KB of program space!

Or, like that Hillshire Farms commercial: "If you don't know, you don't know."
 
Back
Top