memory leak in the BEAM.
Geoff Wong
geoff@REDACTED
Thu Aug 10 06:36:31 CEST 2000
Hi all,
Not really a question; but posted for feedback.
I've discovered a memory leak in the BEAM engine.
Found it because some people pointed out Eddie was space
leaking, I traced the leak to what appeared to be the
crypto_drv'er. But after trying to find something wrong
with that I traced it into the BEAM code.
Try this multiple times, if you have crypto, and check the
size of your BEAM process:
-module(leak).
-export([start/0]).
start() ->
crypto:start(),
X = list_to_binary("assadfhesragire9g84390534r134r"),
loop(10000,X).
loop(0,X) ->
done
;
loop(C,X) ->
crypto:md5_final(crypto:md5_update(crypto:md5_init(), X)),
loop(C-1,X)
.
Anyway - here's the patch (it works for me), seems to be
a minor problem with the off heap list of memory chunks, feedback welcome :)
--- erts/emulator/beam/io.c.ORIG Wed Aug 9 17:03:26 2000
+++ erts/emulator/beam/io.c Thu Aug 10 14:17:47 2000
@@ -1446,7 +1446,7 @@
pb->thing_word = make_thing(PROC_BIN_SIZE-1, REFC_BINARY_SUBTAG);
pb->size = b->orig_size;
pb->next = p->off_heap.mso;
- p->off_heap.mso = pb->next;
+ p->off_heap.mso = pb;
pb->val = DriverBinary2Binary(b);
pb->bytes = b->orig_bytes;
p->off_heap.overhead += b->orig_size / BINARY_OVERHEAD_FACTOR / sizeof(E
term);
I'll build a new RPM for Redhat and place it on the eddieware site
(in the next day or so) when I make sure this patch works correctly
with Eddie.
Geoff
More information about the erlang-questions
mailing list