On Sat, 10 Feb 2018 17:05:37 +0000 Ralph Corderoy <ralph@inputplus.co.uk> wrote:
Ralph Corderoy writes:
I built nmh git here with gc 7.6.0-1 by `cheating' with Makefile.
AM_CFLAGS = -Dmalloc=GC_malloc -Dfree=GC_free -Drealloc=GC_realloc
AM_LDFLAGS = -lgc
It works! Well, simpler programs work. scan(1) SEGVs, ditto folder(1).
I did the same here (on FreeBSD amd64) and it too crashed.
Looking a bit deeper, I see that in mf.c:258 strdup() is
called and strdup() uses system malloc(), not GC_malloc().
So I added malloc/realloc/free in sbr/util.c, which call their
corresponding GC_ versions and verified that strdup() does
indeed call GC_malloc(). Now scan goes further but then fails
at sbr/mts.c:342 where getpwuid() is called -- which in turn
calls nsdispatch() and eventually some internal routine calls
GC_free and dies. To debug this I'd have to recompile libgc
with different flags usuch as REDIRECT_MALLOC and link to
libgc before libc. May be in future.
But this is GC, right? We don't need no stinking free()! So I
redefined it to be
void free(void*) {}
And the programs I tried worked fine. Running best scan time
for 200K messages, scan+gc takes 13.5 seconds while the
regular scan 7.4 seconds. Looking top, the GC version takes
27MB while the nonGC version 22MB.
--
Nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers