Monday, 28 July 2014

Re: Stack usage

On Sun, 27 Jul 2014 23:23:12 +0100, Vincent Sanders wrote:

> On Sat, Jul 26, 2014 at 01:22:01AM +0100, Chris Young wrote:
> > I have just discovered that
> > http://git.netsurf-browser.org/netsurf.git/tree/amiga/gui.c is using
> > ~450K of stack space.
> >
> > Visiting
> > http://libxad.cvs.sourceforge.net/viewvc/libxad/libxad/portable/clients/LhA.c?view=markup
> > uses just short of 1MB of stack.
> >
>
> well that would seem to be excessive on any scale!
>
> > I don't know about the second link, but I'm sure it wasn't that long
> > ago when the top link was viewable in 256K of stack or maybe even
> > 128K.
>
> I would have expected 64k or so at most but analysis of stack usage
> seems to be somewhat difficult.

I'm using a tool which shows me the maximum stack usage up to that
point. So I can only see when something has gone over, but not what.

> I have done an experiment with the gtk frontend which you migth want
> to do for amiga.
>
> add -fstack-usage to your CFLAGS in your Makefile.target and recompile
> from clean (needs gcc 4.6 or later) though this seems to interact
> badly with ccache so I just commented it out in netsurfs Makefile
> (line 307)

I'm using gcc 4.7.2, but it doesn't seem to like that option.

> most of which does not seem exsessive (aside from urldb, which we
> already know "as a project" smells bad)
>
> so assuming amiga gets similar output I must conclude eiher we are
> recursing somewhere or something is dynamicaly allocating to the stack
> where it should not.

My hunch is that either libdom or libcss are the culprit, rather than
NetSurf itself. I think the extra crashing (due to stack usage) I
spotted coincided with a big libdom merge, although that could well
not be related.

Chris

No comments:

Post a Comment