Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You cannot only use a stack, because a stack requires a last-in first-out allocation &amp; deallocation order (i.e. you can only deallocate the newest allocated data; in a stack you cannot deallocate some old data and keep some newer one).</p> <p>Actually, you can get rid of the stack (only keeping the heap). See Appel's paper <a href="http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.39.8219" rel="nofollow noreferrer">Garbage Collection Can Be Faster Than Stack Allocation</a> and his <a href="http://www.cs.princeton.edu/~appel/papers/cwc.html" rel="nofollow noreferrer">Compiling with Continuation</a> book.</p> <p>And heap does not have a well defined meaning (other than "dynamically allocated memory which is not on the stack"). Actually, on Linux systems, allocating a big chunk of memory using the <a href="http://linux.die.net/man/2/mmap" rel="nofollow noreferrer">mmap</a> system call is fairly quick (but <code>malloc</code> implementations try to avoid <code>mmap</code> and prefer reusing <code>free</code>-d memory). The issue is allocation of small memory zones.</p> <p>And read more about <a href="http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29" rel="nofollow noreferrer">garbage collection techniques</a>. In C or C++ you might use <a href="http://www.hpl.hp.com/personal/Hans_Boehm/gc/" rel="nofollow noreferrer">Boehm's GC</a></p> <p>A stack is often useful, notably for recursive function calls. It is so useful (e.g. in C) that today's processors usually have a dedicated stack pointer register (used by CALL &amp; RET machine instructions for calling &amp; returning). But this was not always the case; on some processors (eg IBM360), the stack pointer is a conventional register, not a hardcoded one.</p> <p>See also <a href="https://stackoverflow.com/a/9512031/841108">this</a> &amp; <a href="https://stackoverflow.com/a/31260460/841108">that</a> answers (and other ones) about <a href="https://en.wikipedia.org/wiki/Virtual_address_space" rel="nofollow noreferrer">virtual address space</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload