diff options
author | Lukas Larsson <[email protected]> | 2016-04-26 15:19:56 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-04-26 15:36:41 +0200 |
commit | d0bca6c9aceb6b5be35342387d6bbbf0f3c5244c (patch) | |
tree | b0885f5d37d58bf59fb15384a10b39d51b72cd5b /erts/emulator/test | |
parent | 6aae129123c4ce8988cc67b3545db9d1ec51324b (diff) | |
download | otp-d0bca6c9aceb6b5be35342387d6bbbf0f3c5244c.tar.gz otp-d0bca6c9aceb6b5be35342387d6bbbf0f3c5244c.tar.bz2 otp-d0bca6c9aceb6b5be35342387d6bbbf0f3c5244c.zip |
erts: Fix total_heap_size calculation for on_heap
Diffstat (limited to 'erts/emulator/test')
-rw-r--r-- | erts/emulator/test/message_queue_data_SUITE.erl | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/erts/emulator/test/message_queue_data_SUITE.erl b/erts/emulator/test/message_queue_data_SUITE.erl index 37523d68e1..226462676c 100644 --- a/erts/emulator/test/message_queue_data_SUITE.erl +++ b/erts/emulator/test/message_queue_data_SUITE.erl @@ -21,7 +21,7 @@ -module(message_queue_data_SUITE). -export([all/0, suite/0]). --export([basic/1, process_info_messages/1]). +-export([basic/1, process_info_messages/1, total_heap_size/1]). -export([basic_test/1]). @@ -32,7 +32,7 @@ suite() -> {timetrap, {minutes, 2}}]. all() -> - [basic, process_info_messages]. + [basic, process_info_messages, total_heap_size]. %% %% @@ -190,6 +190,28 @@ process_info_messages(Config) when is_list(Config) -> ok. +total_heap_size(_Config) -> + + Fun = fun F() -> receive Pid when is_pid(Pid) -> Pid ! ok,F() end end, + + %% Test that on_heap messages grow the heap even if they are not received + OnPid = spawn_opt(Fun, [{message_queue_data, on_heap}]), + {total_heap_size, OnSize} = erlang:process_info(OnPid, total_heap_size), + [OnPid ! lists:duplicate(N,N) || N <- lists:seq(1,100)], + OnPid ! self(), receive ok -> ok end, + {total_heap_size, OnSizeAfter} = erlang:process_info(OnPid, total_heap_size), + ct:log("OnSize = ~p, OnSizeAfter = ~p",[OnSize, OnSizeAfter]), + true = OnSize < OnSizeAfter, + + %% Test that off_heap messages do not grow the heap if they are not received + OffPid = spawn_opt(Fun, [{message_queue_data, off_heap}]), + {total_heap_size, OffSize} = erlang:process_info(OffPid, total_heap_size), + [OffPid ! lists:duplicate(N,N) || N <- lists:seq(1,100)], + OffPid ! self(), receive ok -> ok end, + {total_heap_size, OffSizeAfter} = erlang:process_info(OffPid, total_heap_size), + ct:log("OffSize = ~p, OffSizeAfter = ~p",[OffSize, OffSizeAfter]), + true = OffSize == OffSizeAfter. + %% %% %% helpers |