fix: heap size is growing very fast when trace large msg
This commit is contained in:
parent
0402903d71
commit
637202e463
|
@ -442,18 +442,18 @@ format_header(#mqtt_packet_header{type = Type,
|
||||||
dup = Dup,
|
dup = Dup,
|
||||||
qos = QoS,
|
qos = QoS,
|
||||||
retain = Retain}, S) ->
|
retain = Retain}, S) ->
|
||||||
S1 = case S == undefined of
|
Header = io_lib:format("~s(Q~p, R~p, D~p)", [type_name(Type), QoS, i(Retain), i(Dup)]),
|
||||||
true -> <<>>;
|
case S == undefined of
|
||||||
false -> [", ", S]
|
true -> Header;
|
||||||
end,
|
false -> [Header, S]
|
||||||
io_lib:format("~s(Q~p, R~p, D~p~s)", [type_name(Type), QoS, i(Retain), i(Dup), S1]).
|
end.
|
||||||
|
|
||||||
format_variable(undefined, _) ->
|
format_variable(undefined, _) ->
|
||||||
undefined;
|
undefined;
|
||||||
format_variable(Variable, undefined) ->
|
format_variable(Variable, undefined) ->
|
||||||
format_variable(Variable);
|
format_variable(Variable);
|
||||||
format_variable(Variable, Payload) ->
|
format_variable(Variable, Payload) ->
|
||||||
io_lib:format("~s, Payload=~0p", [format_variable(Variable), Payload]).
|
[format_variable(Variable), ", Payload=", Payload].
|
||||||
|
|
||||||
format_variable(#mqtt_packet_connect{
|
format_variable(#mqtt_packet_connect{
|
||||||
proto_ver = ProtoVer,
|
proto_ver = ProtoVer,
|
||||||
|
@ -520,4 +520,3 @@ format_password(_Password) -> '******'.
|
||||||
i(true) -> 1;
|
i(true) -> 1;
|
||||||
i(false) -> 0;
|
i(false) -> 0;
|
||||||
i(I) when is_integer(I) -> I.
|
i(I) when is_integer(I) -> I.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue