diff options
author | Lukas Larsson <[email protected]> | 2016-05-11 10:51:36 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-05-11 10:51:36 +0200 |
commit | 8420cbc23f2f2d26e235bcff3fbd94e688bb34f8 (patch) | |
tree | 4f3c348bc9e774fc57c08eadd8911f72e1a85c53 | |
parent | 7e9cfb571bbb60fa498f98f123fa9bffefb07228 (diff) | |
parent | 629163f45f4595e2054e1c6bb5595faf4e3f7d0a (diff) | |
download | otp-8420cbc23f2f2d26e235bcff3fbd94e688bb34f8.tar.gz otp-8420cbc23f2f2d26e235bcff3fbd94e688bb34f8.tar.bz2 otp-8420cbc23f2f2d26e235bcff3fbd94e688bb34f8.zip |
Merge branch 'lukas/erts/max_heap_size/OTP-13175'
* lukas/erts/max_heap_size/OTP-13174:
erts: Add max_heap_size remote gc testcase
-rw-r--r-- | erts/emulator/test/gc_SUITE.erl | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/erts/emulator/test/gc_SUITE.erl b/erts/emulator/test/gc_SUITE.erl index 79c229a34d..8a600b7d9f 100644 --- a/erts/emulator/test/gc_SUITE.erl +++ b/erts/emulator/test/gc_SUITE.erl @@ -25,13 +25,13 @@ -include_lib("common_test/include/ct.hrl"). -export([all/0, suite/0]). --export([grow_heap/1, grow_stack/1, grow_stack_heap/1]). +-export([grow_heap/1, grow_stack/1, grow_stack_heap/1, max_heap_size/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [grow_heap, grow_stack, grow_stack_heap]. + [grow_heap, grow_stack, grow_stack_heap, max_heap_size]. %% Produce a growing list of elements, @@ -163,3 +163,30 @@ show_heap(String) -> {stack_size, SSize}=process_info(self(), stack_size), io:format("Heap/Stack "++String++"~p/~p", [HSize, SSize]). +%% Test that doing a remote GC that triggers the max heap size +%% kills the process. +max_heap_size(_Config) -> + + Pid = spawn_opt(fun long_receive/0,[{max_heap_size, 1024}, + {message_queue_data, on_heap}]), + [Pid ! lists:duplicate(I,I) || I <- lists:seq(1,100)], + Ref = erlang:monitor(process, Pid), + + %% Force messages to be viewed as part of heap + erlang:process_info(Pid, messages), + + %% Do the GC that triggers max heap + erlang:garbage_collect(Pid), + + %% Verify that max heap was triggered + receive + {'DOWN', Ref, process, Pid, killed} -> ok + after 5000 -> + ct:fail({process_did_not_die, Pid, erlang:process_info(Pid)}) + end. + +long_receive() -> + receive + after 10000 -> + ok + end. |