[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Stack vs. heap?
- Subject: Re: Stack vs. heap?
- From: David4602@gmail.com
- Date: 21 Jun 2006 10:52:00 -0700
- Complaints-to: groups-abuse@google.com
- In-reply-to: <e7bnqd$95l$1@theodyn.ncf.ca>
- Injection-info: p79g2000cwp.googlegroups.com; posting-host=129.33.49.251; posting-account=2WMASQ0AAABT3dben-WPOD0pQlvu0xSw
- Newsgroups: comp.sys.apple2
- Organization: http://groups.google.com
- References: <W9cmg.37$oA2.73@news.oracle.com> <1150900396.938998.260090@m73g2000cwd.googlegroups.com> <e7bnqd$95l$1@theodyn.ncf.ca>
- User-agent: G2/0.2
- Xref: g2news2.google.com comp.sys.apple2:9553
Michael Black wrote:
> And isn't a heap something that comes and goes?
Yes, definitely. In higher level languages, heaps come and go as code
that requires it comes into and goes out of scope.
> Ie, you need some storage, it gets allocated, and then
> the memory is returned to free memory after
> it's not being used.
Yes.
> This is different from variables that remain forever, such as the system
> variables that use up the zero-page.
Global variables are different than the heap - or perhaps global
variables are the first heap that doesn't go out of scope until the
program ends. (I'm not talking about 6502 programming specifically
here, I'm talking about more generic high-level language
implementations.)
> And to reference your last bit about how heaps can make use of the stack,
> that can be done because they aren't long term storage.
Heaps don't necessarily make use of _the_ (6502) stack - they typically
make use of _a_ stack (fifo) construct.