A few observations Re: Clean

Michael Schuerig schuerig@acm.org
Thu, 9 Apr 1998 01:09:33 +0200


At 23:37 Uhr +0200 08.04.1998, Adrian Hey wrote:
> > >Gripe 2 - Memory Allocation
> > >---------------------------
> > >When compiling a program you have to specify how much heap space and
> > >stack space to use separately. The problem with this is how can you
> > >really know the best values. In most cases these will depend entirely
> > >on what data the program gets. It would help if just 1 value
> > >(total memory to use) was supplied and the run-time system made best
> > >possible use of this memory using stack-heap collision detection.
> > >(Or better still, if the OS allows, the application could just grab
> > >memory as required at run time. I suspect MacOS won't let you do this
> > >though, since even the latest versions of this supposedly wonderful OS
> > >don't seem to be able to sort out memory fragmentation without a
> > >shutdown.)
> >
> >This is indeed the problem.
>
> Hmm.. You don't appear to be very confident regarding a solution.
> I'm not really sure I understand what the problem is...
> Is it a Clean implementation problem? If so it shouldn't be to hard
>to fix.
> or...
> Is it an OS problem? If so it must afflict applications programmers using
> whatever language. I wonder what they do about it.

It's an OS problem. The Mac OS wants to know beforehand how much memory
to allocate to an application. And beyond that, if your app needs a
different stack size from what it gets by default (24k for 680x0,
64k(?) for PPC) it needs to be set shortly after app startup.

The only way around this is to use so-called "temporary memory". The
problem is that if your app forgets to return this memory to the system
no-one will.


> It seems to me that this is a pretty serious problem. You might be
> able to live with it whilst developing 'experimental' software on your
> own machine. But what if you were to use Clean for a commercial
> application? You wouldn't know how much memory end users had, so you
>would
> be wise to set the figures small. But somebody who had invested in
>256Mb RAM
> might get a bit annoyed if the application only used 8Mb and then stopped
> complaining about lack of memory.
> Have I missed something here?

Yes: look at the window that you get when you choose "File>Get Info" in
the Finder. There you can set how much app is allocated to your app.


Michael