"Bryan Parkoff" <nospam@[EMAIL PROTECTED]
> wrote in message
news:481fc7cd$0$7692$4c368faf@[EMAIL PROTECTED]
> I want to know how much static memory is limited before execution
> program starts. I would write a large array. The large array has
65,536
> elements. The data size is double word. The static memory would
allocate
> 256K. The 256K is a fixed memory size. After the compiler has
completed
> compiling header and source code, the execution program might fail to
run
> or crash. The operating system might do not display error message
saying,
> "Insufficient memory."
> The dynamic memory may be the option. The malloc() function can test
> to determine if allocated memory is available at run-time. Then, use
I/O
> like fopen() and fclose() functions to read data from the hard drive and
> store it into RAM. The error message can display at run-time if
malloc()
> tests to tell insufficient memory.
> Please give me your advice. How much static memory can be limited
> before execution program starts?
There is no simple answer to your question. It will depend on your
hardware, on your operating system, on your compiler, on what other
programs
are in memory at the time, on how much virtual memory you have, and
(possibly) on your user limit and a number of other factors.
The malloc() function is also dependent upon all of the above things.
Automatic memory is even more limited.
The best way to find out if you can get a block of memory of a certain
size
is to attempt to allocate it. If the allocation fails, then you can't get
it.
** Posted from http://www.teranews.com
**


|