[gccsdk] Using Dynamic Areas

Adam lists at snowstone.org.uk
Sat Jul 19 08:52:02 PDT 2008


In message <467a5dc14f.Jo at hobbes.bass-software.com>, John Tytgat  wrote:

> In message <d6715ac14f.admin at snowstone.org.uk>
>           Adam <lists at snowstone.org.uk> wrote:
> 
> > On 19 Jul, Lee Noar  wrote:
> > 
> > > Adam wrote:
> > > > Hi,
> > > > 
> > > > How do I enable the use of dynamic areas for my app, rather than
> > > > the default use of the wimpslot (GCC3.4.6)?
> > > 
> > > You set a system variable with a name based on that of your
> > > binary, eg,  for gcc you would use:
> > > 
> > > Set gcc$heap ""
> > 
> > OK, thanks. Does <appname$heap> have to be active at compile time,
> > or just run time?
> 
> At run time.  Just curious: why would you like specifically set it ?

I'm using RO4.39 and ran out of memory in the wimpslot (parsing a large
xml file).


> We had an older suggestion to actually change the default (when
> appname$heap is not set) based on whether we're running on RISC OS 5
> or not (i.e. whether the WimpSlot size is limited to 28 MByte or not)
> as this is probably the biggest reason to explicitly set it.

I think the current behaviour is good as it's consistent across
platforms.

I've not really paid any attention to the differences between the
wimpslot and dynamic areas up until now as I've never needed to worry
about a large-footprint app before...


> > Anyway, I guess that means I have to give my binary a name
> > somehow...
> 
> I don't think so.  Suppose you have a !RunImage built which is hardly
> unique in its name and being part of real Wimp application, I think
> you can actually use your application name and use appname$heap while
> setting this too as __program_name string to "appname".

Yes, I think that's where I was getting to... ;)


> > Looking at the Usage file[1] and the UnixLib header files, I think I
> > need to do:
> > 
> >   #include <unixlib/features.h>
> 
> #include <features.h>, no ?

Thanks. (That line was derived from the example in the Usage file.)


> No I don't think so.  I think just a little bit more documentation is
> needed.  I *think* you just need to add:
> 
>   const char *__program_name = "BayTrader";

That complains about conflicting declarations, but using "const char *
const" (as per the line in features.h) works and produces a dynamic area
:)


Thanks a lot,
Adam

P.S. I've just been playing around with AppName$HeapMax and noticed that
if you set it to a small value, the initial dynamic area is restricted to
that size, but then a series of 1MB areas, called "<AppName> MMap" get
created. What's the significance of this?

-- 
Adam Richardson          Carpe Diem
http://www.snowstone.org.uk/riscos/




More information about the gcc mailing list