Afficher un message
Vieux 06/05/2008, 22h48   #7
Chris Thomasson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Allocate Static Memory?

"Bryan Parkoff" <nospam@nospam.com> wrote in message
news:481fc7cd$0$7692$4c368faf@roadrunner.com...
> 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?


This is off-topic wrt your question, but you can build an allocator on a
plurality of threads stack spaces... I did a memory allocation scheme in an
environment that did not have a heap. IIRC, the OS was an older version of
Quadros on ARM9. No, heap, but each Quadros Task had stack space. So, I
built the heap on a per-thread/task allocation algorithm. Something like:

http://groups.google.com/group/comp....c825ec9999d3a8

But it used bin-sema for locks instead of atomic operations. The only atomic
operation available on the ARM9 is a SWP instruction. I also used some stack
space for a globally shared heap. The entire allocation system was based on
task stacks.

  Réponse avec citation
 
Page generated in 0,06567 seconds with 9 queries