Path: chuka.playstation.co.uk!scea!peter_alau@playstation.sony.com From: jamin1@psu.edu (Jamin Frederick) Newsgroups: scea.yaroze.programming.2d_graphics Subject: Re: I can't stand it anymore! Date: Wed, 03 Jun 1998 22:58:45 GMT Organization: SCEA News Server Lines: 56 Message-ID: <3575d43b.87469674@news.scea.sony.com> References: <35736b7c.12437918@news.scea.sony.com> <357479f7.106779210@news.scea.sony.com> <357481E0.452ABE74@netmagic.net> Reply-To: jamin1@psu.edu NNTP-Posting-Host: MAXWELL.hq.ensco.com X-Newsreader: Forte Free Agent 1.11/32.235 On Tue, 02 Jun 1998 15:51:12 -0700, Elliott Lee wrote: >Jamin Frederick wrote: >> >> On Tue, 02 Jun 1998 03:11:44 GMT, antony.arciuolo@mail.trincoll.edu >> (Antony Arciuolo) wrote: >> >> >I will ask the stupid question. How do you load files into main memory >> >and prevent them from being overwritten by the code allocating memory? >> > >> >> When you malloc() memory, you're adding space to the heap, which grows >> up from the (static) program code. The stack, which grows down from >> where you set it, is allocated from function calls and local >> variables. So what most people do is this: > >Although I wondered about that---whether the Yaroze stack is growing >downwards or upwards because the docs stated that you the area between >0x801f0000-0x801fffff was designated for stack. That is not the program stack, that area is the system stack that the OS proprietarily uses. > I would hope that for >any malloc()-ing that is done, the amount of space is calculated >before-hand as to not collide with the designated stack area. > Yea, there's some methods to check to make sure this doesn't happen. If it does, the system will (probably) freeze. >What I generally do is actually block off an area in my programming >(not using malloc()) and make a note that it is a scratchpad area. >e.g. 0x80090000-0x800b0000 is for game maps and manipulation of them. >(Using #defines for this can also save a few cycles of pointer >dereferencing.) > >> Stack (top of allowed yaroze space) >> | >> * >> >> (hope stack & heap don't collide!) >> >> * >> | >> Heap >> Code (Loaded above Data) >> Data (Loaded @ 90080000 and up -- bottom of allowed yaroze space) >> >> Jamin > >- e! > tenchi@netmagic.net > http://www.netmagic.net/~tenchi/yaroze/