CNMAT / CNMAT-Externs

CNMAT Max/MSP externals
Other
96 stars 11 forks source link

xydisplay makes max crash (memory leaks ?) #141

Open damienjacquet opened 1 year ago

damienjacquet commented 1 year ago

after several minutes of intensive use of xydisplay on a mac, max crashes and leaved the attached report bug_report_ness.txt

I'm not a developer, so according to chatGPT (this is not serious isn't it ?): "The stack trace shows that the crash occurred while trying to paint a component in the application. The crash was caused by a pointer authentication failure, which could indicate a memory issue."

the xy_paint is cited in the report (line 9 of thread 0) and here are some clues given by chatGPT also :

"One thing to note is that the code uses a hash table to store points, which can be a potential source of memory leaks if the hash table is not properly managed. The t_point struct has a next and prev pointer which suggests that it is used in a linked list. If a point is removed from the linked list but not removed from the hash table, it will cause a memory leak.

It's also important to check if all allocated memory is properly freed in the xy_free function."

Hope this helps

Damien

damienjacquet commented 1 year ago

further analysis on windows : I use the xydisplay object in a max4live plugin (you can download it there : https://www.apg.audio/en/products/softwares/ness-en/198-ableton-plugin.html) If I use 2 or 3 occurrences of the same plugin, Ableton live crashes and gives me this crash report: Ableton Crash Report 2023-04-13 160448 Live 11.2.11.zip

If you open the .dmp file in the crash folders and ask Windbg to open it and analyze it, I have those results:


CONTEXT: (.ecxr) rax=00000000ff10a4ee rbx=000000004b502f70 rcx=000000004b365a60 rdx=0000000000000010 rsi=0000000000000001 rdi=000000000014c760 rip=00007ff9dee51695 rsp=000000000014c700 rbp=00007ff9dee5e006 r8=00000000000000a4 r9=00000000000000ee r10=00000000000002c0 r11=000000000014c6b0 r12=0000000046fed770 r13=000000002d74e280 r14=0000000000000000 r15=bfddb34700000000 iopl=0 nv up ei pl nz na pe nc cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010202 xydisplay!xy_paint+0x2b5: 00007ff9 dee51695 f2410f1037 movsd xmm6,mmword ptr [r15] ds:bfddb347 00000000=???????????????? Resetting default scope

EXCEPTION_RECORD: (.exr -1) ExceptionAddress: 00007ff9dee51695 (xydisplay!xy_paint+0x00000000000002b5) ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000 NumberParameters: 2 Parameter[0]: 0000000000000000 Parameter[1]: ffffffffffffffff Attempt to read from address ffffffffffffffff

PROCESS_NAME: Ableton Live 11 Standard.exe

READ_ADDRESS: ffffffffffffffff

ERROR_CODE: (NTSTATUS) 0xc0000005 - L'instruction 0x%p emploie l'adresse m moire 0x%p. L' tat de la m moire ne peut pas tre %s.

EXCEPTION_CODE_STR: c0000005

EXCEPTION_PARAMETER1: 0000000000000000

EXCEPTION_PARAMETER2: ffffffffffffffff

STACK_TEXT:
000000000014c700 000000002a4935ae : 4338000000000007 000000004b503e70 0000000043786400 000000003e9cab10 : xydisplay!xy_paint+0x2b5

ChatGPT: In this context, offset 0x2b5 refers to the memory address of the instruction that caused the exception. Specifically, the offset is the distance in bytes from the beginning of the function "xy_paint" to the instruction that generated the access violation.

In this case, the instruction is "movsd xmm6,mmword ptr [r15]", which attempted to read from the memory address ffffffffffffffff, causing the access violation

Hope this helps ! don't hesitate to contact me if you need further information !