-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MemoryManager: Null pointer deallocation attempted #2023
Comments
And here's a backtrace for all you lovely folks:
|
Also, this error is triggered by a part of the SampleBuffer.cpp code that's conditionally compiled. It can only be reached when building without FLAC (i.e. LMMS_HAVE_FLAC_STREAM_DECODER_H is undefined). (edit: I incorrectly linked to line 1355 instead of 1362 of SampleBuffer.cpp) |
FYI - This was mostly committed here 9c25be1#diff-cc740586f26342e6e68642925c6fc52bR61 as part of the Don't know if that's much help... Off-topic, but I found these lines interesting |
@tresf well those lines are interesting! So then I guess this error ought to be present on builds regardless of FLAC support. |
Confirmed on the current |
@Wallacoloo this console error also displays when trying to reproduce #2378. My console displays this:
This bug was opened previously against the wrong branch here #1352 and probably prematurely closed, since it was valid for master. |
I think the null pointer deallocation should be safe to fix by changing from if ( m_origData )
{
MM_FREE( m_origData );
} in Here's what happens:
So there seem to be valid path through Another question is whether the check Something * s = new Something();
delete s;
s = 0;
delete s; It is not nice but legal. So it might be that |
This same null check technique is used all over the place in So we can assume this bug is perfectly benign in this context, right? |
Given that But yes, my understanding is that this bug is benign. Also, I'm curious about the necessity of a "memory manager", which appears to just provide an alternative implementation of malloc/free. IMO, if glibc's malloc/free are too slow for lmms, it seems like it would be more productive to use a drop-in replacement like TCmalloc (as an example), rather than rolling our own. |
Yeah, as far as I remember, benchmarks weren't conclusive whether or not rolling our own MemoryManager were warranted, here's the conversation thread... #1088 and also more conversation here (perhaps what inspired it)... #1053 (comment)
Hiding the warning is probably a good idea then.. |
@Wallacoloo IIRC the point of |
The problem is that The cleanest (but obviously also hardest) solution would be to get rid of dynamic allocations wherever possible and to make sure that the remaining dynamic allocations are not performed in the audio processing thread. Here is some interesting read on the things that should not be done in the audio thread: http://www.rossbencina.com/code/real-time-audio-programming-101-time-waits-for-nothing |
What's critical about this issue, really? It's not like LMMS doesn't spew out a few other warnings as well. Disabling it for release builds should be enough IMO. (Thought |
It's probably not after further investigation. Since it often happens before a crash, it was bumped to critical, but further investigation seems to suggest it is purely cosmetic... or to quote @Wallacoloo...
Critical priority removed. 👍 |
So should it be bumped to 1.3? |
Not necessarily since the fix is probably going to be removing a debug statement. 👍 |
Removes the warning "MemoryManager: Null pointer deallocation attempted" from MemoryManager. The warning does not make sense because deallocations of null pointers are ok in C++. Fixes LMMS#2023.
Fixed with pull request #2406. |
Steps to reproduce:
ctrl+z
or by using the edit menu.ctrl+y
or by using the edit menu.After step 4, the text "MemoryManager: Null pointer deallocation attempted" should be printed to the console.
This affects current master (so e.g. it's definitely not due to the unmerged #2022 PR that modifies undo/redo shortcuts)
The text was updated successfully, but these errors were encountered: