Re: Allocate Static Memory?
On May 5, 10:50 pm, "Bryan Parkoff" <nos...@nospam.com> wrote:
> 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?
The only thing the Standard says is in this regard is that a hosted
environment must allow an object of at least 65,535 bytes to be
created (32,767 bytes for C89). This doesn't mean that multiple
objects of this size can be created or that multiple objects totaling
this limit must be allowed and it isn't specified whether the limit be
achievable via static or dynamic allocation. For more details you
will need to consult the documentation for your implementation.
--
Robert Gamble
|