Path: chuka.playstation.co.uk!news From: Chris Chadwick Newsgroups: scee.yaroze.programming.gnu_compiler Subject: Re: Memory allocation probs... Date: Mon, 03 Nov 1997 02:00:26 -0800 Organization: PlayStation Net Yaroze (SCEE) Lines: 31 Message-ID: <345DA0BA.4D5C@dial.pipex.com> References: <34551BB5.58BA@dial.pipex.com> <3454c596.21265918@news.playstation.co.uk> <3456076E.92B9FC58@micronetics.com> <3456FA5F.DB8@dial.pipex.com> <345695E0.6102@peace.co.nz> <3457216F.61478ECA@micronetics.com> <34599B1E.4515@dial.pipex.com> NNTP-Posting-Host: ak060.du.pipex.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 2.02 (Win95; I; 16bit) Joel (First, I just tried sending this same message but I think I sent it to your mail, by mistake. Sorry.) Thanks for the reply, which leads me to... Joel Sumner wrote: > > In article <34599B1E.4515@dial.pipex.com>, Chris Chadwick > wrote: > > > >Now, arg 'size' is the amount of mem you want to allocate as the heap, > >specified in 4-byte units ('head' has to be a 4-byte aligned address > >as well, then?). Do I, then, have to make sure I don't allocate so > >much mem that the stack may creep down and clash with it? > > It's probably best to use linker generated variables to determine this. If > you take the stack top and subtract the stack size and the bss end address, > that will give you the max heap zone size. Since it is 100% based on > linker variables, you'll never have to fiddle with the number. This sounds like the solution I'm looking for but I cant seem to find any details about linker variables. Could you (or anyone) give me a quick example of how I can use them do achieve what you've detailed in the above paragraph? Thanks in advance! Chris