Created
September 20, 2016 08:36
-
-
Save redink/177dca332e58b2bf7c59e694b57aac8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(test_route_binary_leak). | |
-behaviour(gen_server). | |
-export([start_link/0]). | |
-export([test_route_binary_leak/1]). | |
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, | |
terminate/2, code_change/3]). | |
-define(SERVER, ?MODULE). | |
-define(FAKEPID, list_to_pid("<0.11111.0>")). | |
-record(state, {}). | |
start_link() -> | |
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). | |
test_route_binary_leak(Binary) -> | |
gen_server:call(?SERVER, {test_route_binary_leak, Binary}). | |
init([]) -> | |
{ok, #state{}}. | |
handle_call({test_route_binary_leak, ThisBigBinary}, _From, State) -> | |
erlang:send(?FAKEPID, {send_binary_to_fake_pid, ThisBigBinary}), | |
% {reply, ok, State, hibernate}; | |
{reply, ok, State}; | |
handle_call(_Request, _From, State) -> | |
{reply, ok, State}. | |
handle_cast(_Msg, State) -> | |
{noreply, State}. | |
handle_info(_Info, State) -> | |
{noreply, State}. | |
terminate(_Reason, _State) -> | |
ok. | |
code_change(_OldVsn, State, _Extra) -> | |
{ok, State}. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
test 1
use
hibernate
when callback return.memory for
binary
did not change obviously.