Skip to content

Commit 554caee

Browse files
committed
Fix mmap size estimation for Elixir.ErlangError on aarch64
Signed-off-by: Paul Guyot <[email protected]>
1 parent ff568e9 commit 554caee

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

libs/estdlib/src/code_server.erl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,14 @@ load(Module) ->
201201
end.
202202

203203
%% @doc Estimate the required native code for a given bytecode size.
204-
%% Currently, the only live stream backend is mmap which needs this estimate
205-
%% and should not be passed a value too large to not slow down valgrind too
206-
%% much during tests. A factor of 20 is more than enough, the ratio is closer
207-
%% to 9 on x86-64.
208-
%% This will need some rework once we start using flash on MCUs.
204+
%% Currently, the only live stream backend that needs estimate is mmap
205+
%% and it should not be passed a value too large to not slow down valgrind too
206+
%% much during tests. A factor of 32 is more than enough, the largest observed
207+
%% ration is 21 for aarch64 and Elixir code. Also apply a minimum of 128 kb
208+
%% which shouldn't affect valgrind too much.
209+
%% jit_stream_flash and jit_stream_binary ignore the size parameter.
209210
%% @return size in bytes
210211
%% @param Size bytecode size
211212
-spec jit_mmap_size(pos_integer()) -> pos_integer().
212213
jit_mmap_size(Size) ->
213-
Size * 20.
214+
max(Size * 32, 128 * 1024).

0 commit comments

Comments
 (0)