On Wed, 13 Feb 2013 21:16:45 +0000 (GMT), Michael Drake wrote:
> I'm also getting a serious memory leak during usage, but
I'm not sure
> - all I know is that it appears to have started within the last week
> (and it isn't my box redraw queue - I've checked that), and typing
> things into textareas eventually grinds to a halt (due to lack of
> memory - although it might not be the typing into textareas which is
> the cause)
This is concerning. I'll have a look.
I think I've tracked this down to a bug (or "implementation feature",
perhaps) in OS4's newlib realloc() function.
If I allocate 10MB of memory in 64 byte chunks using realloc(), around
400MB of RAM gets eaten up, rather than the expected 10MB. I've tried
the same test with clib2, and - aside from the fact it takes forever
and I can't be bothered to wait for it to complete - it seems to work
correctly (in that it isn't allocating vast amounts of memory beyond
what was requested)
However I can't (nor do I want to) build NetSurf against clib2.
I toyed with the idea of addng my own malloc/realloc/free
implementations to NetSurf, until I realised that I'd need to also add
them to all of NetSurf's dependencies, because some things might be
allocated by one library and freed using free() (or vice versa).
Any suggestions on how to work around this bug would be appreciated,
as I have no idea how long it will take for a fix to be released.