Slogan: binary_alloc: Cannot reallocate 2986288524 bytes of memory (of type "binary").

Hi everyone,
During run test I have encounter with my test. Does anyone know the reason and help me? Thank you.

An attempt was made to allocate a chunk of memory, almost 3GB, for a binary(). If that is what you meant to do, you need more memory in your server. More likely is that you have created a loop without “tail recursion” and are therefore not freeing what should be unused memory.

1 Like

Thank you for your information, BTW, if possible, I can reach out you by email to ask more detail some question. Thank you.
my email: phungthanhvan1207@gmail.com

Hi Vances,
I am trying to reproduce the issue on my local and I got it, but workflow it is difference I am wondering why that. Could you tell me why? Thank you.
Original log:
=erl_crash_dump:0.5
Wed Jul 17 18:16:45 2024
Slogan: binary_alloc: Cannot reallocate 2805316176 bytes of memory (of type “binary”).
System version: Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [jit:ns]
Taints: asn1rt_nif,crypto
Atoms: 30436
Calling Thread: scheduler:1
=scheduler:1
Scheduler Sleep Info Flags:
Scheduler Sleep Info Aux Work: DELAYED_AW_WAKEUP | MISC_THR_PRGR
Current Port:
Run Queue Max Length: 0
Run Queue High Length: 0
Run Queue Normal Length: 0
Run Queue Low Length: 0
Run Queue Port Length: 0
Run Queue Flags: OUT_OF_WORK | HALFTIME_OUT_OF_WORK | NONEMPTY | EXEC
Current Process: <0.19487.0>
Current Process State: Running
Current Process Internal State: ACT_PRIO_NORMAL | USR_PRIO_NORMAL | PRQ_PRIO_NORMAL | ACTIVE | RUNNING
Current Process Program counter: 0x00007f10e1bcf24c (erts_internal:flush_monitor_messages/3 + 140)
Current Process Limited Stack Trace:
0x00007f10bc4aa448:SReturn addr 0xE26F9CDC (Y:stop_log/3 + 116)
0x00007f10bc4aa470:SReturn addr 0xE26FD524 (Y:‘-stop/2-fun-1-’/2 + 164)
0x00007f10bc4aa498:SReturn addr 0xE26C1A10 (Z:spm_worker/2 + 560)
0x00007f10bc4aa4c0:SReturn addr 0xE1B44008 ()
reproduce log:
=erl_crash_dump:0.5
Thu Jul 25 03:13:09 2024
Slogan: binary_alloc: Cannot reallocate 123979720 bytes of memory (of type “binary”).
System version: Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [jit:ns]
Taints: crypto
Atoms: 30699
Calling Thread: scheduler:1
=scheduler:1
Scheduler Sleep Info Flags:
Scheduler Sleep Info Aux Work: THR_PRGR_LATER_OP
Current Port:
Run Queue Max Length: 0
Run Queue High Length: 0
Run Queue Normal Length: 6
Run Queue Low Length: 0
Run Queue Port Length: 0
Run Queue Flags: NONEMPTY_NORMAL | OUT_OF_WORK | HALFTIME_OUT_OF_WORK | NONEMPTY | EXEC
Current Process: <0.760.0>
Current Process State: Running
Current Process Internal State: ACT_PRIO_NORMAL | USR_PRIO_NORMAL | PRQ_PRIO_NORMAL | ACTIVE | RUNNING
Current Process Program counter: 0x00007fed10f5d1e8 (K:increase_binary_size/3 + 48)
Current Process Limited Stack Trace:
0x00007fed0d874d80:SReturn addr 0x10F5CBAC (X:do_get_log/4 + 1148)
0x00007fed0d874d90:SReturn addr 0x10F60F5C (Y:stop_log/3 + 116)
0x00007fed0d874db8:SReturn addr 0x10F647A4 (Y:‘-stop/2-fun-1-’/2 + 164)
0x00007fed0d874de0:SReturn addr 0x10F28AD0 (Z:spm_worker/2 + 560)
0x00007fed0d874e10:SReturn addr 0x10378008 ().

The stack trace points at an spm_worker/2 function which is ultimately winding up in a do_get_log/4 function.

hi Vances,
Current Process Program counter: 0x00007f10e1bcf24c (erts_internal:flush_monitor_messages/3 + 140)
Current Process Limited Stack Trace:
0x00007f10bc4aa448:SReturn addr 0xE26F9CDC (Y:stop_log/3 + 116)
0x00007f10bc4aa470:SReturn addr 0xE26FD524 (Y:‘-stop/2-fun-1-’/2 + 164)
0x00007f10bc4aa498:SReturn addr 0xE26C1A10 (Z:spm_worker/2 + 560)
0x00007f10bc4aa4c0:SReturn addr 0xE1B44008 ()

I am wondering where the function is (erts_internal:flush_monitor_messages/3 + 140) because my repo hasn’t this function.
Thank you.

It’s right here.

Hi Vances,
I know that, but I would like to know why in my code call function apply(Callback,get_log,[Log,StartPos,EndPos]. when it crashes the final function is (erts_internal:flush_monitor_messages/3 + 140) , but when I am trying to reproduce the problem, the final function is 0x00007fed10f5d1e8 (K:increase_binary_size/3 + 48).

this function increase_binary_size() use for increase size of Data.

I am wondering why it doesn’t call (erts_internal:flush_monitor_messages/3 + 140) .
I am quite confusion.

Thanks a lot.