-
Notifications
You must be signed in to change notification settings - Fork 8k
Drop MYSQLND_DEBUG_MEMORY as it is always true #5586
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
Conversation
ext/mysqlnd/mysqlnd_alloc.c
Outdated
#if ZEND_DEBUG | ||
#if PHP_DEBUG | ||
#else | ||
#define __zend_orig_filename "/unknown/unknown" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this else necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this whole section needs to be dropped, thanks for pointing this out
df24724
to
e2ee6a6
Compare
Hmm, this has been introduced with commit 37418de, but looks somewhat unfinished. @andreyhristov? |
Why does it look unfinished (xcept for the possibility of a configure time switch)? The macro drives definition of debug functions and there is an alternative. Yes, it has been enabled for a while but it doesn't mean it can't be disabled.
|
I think we'd be better off going the other way around here and dropping mnd_alloc flavors completely. Nowadays the most memory-hungry parts of mysqlnd no longer go through mnd_alloc (they're backed by zend_arena, which we don't want to parameterize over the allocator), so I think the usefulness of this functionality is pretty questionable at this point. |
It was built it to provide possibility to track and profile memory allocations. Does the zend_arena has this, I mean per extension/core to be able to track memory allocations - in look for possible leaks (C code) but also for who did what? |
No, it doesn't. My point was specifically that the largest memory allocations in mysqlnd already do not make use of this tracking functionality, so the benefit of retaining it seems somewhat dubious. If we want to analyze memory allocation behavior, we use a memory profiler (I usually use massif). |
I don't mind either way, but if we drop the mnd_alloc version, I'll rework this so that every call to the |
FWIW I also don't care strongly here and would be fine with just leaving the code alone entirely. It just seems like some complexity we could do without, and that nobody maintains. We generally don't like working on mysqlnd code due to the large amount of unnecessary over-abstraction it contains, that makes all changes hard and prone to ABI breakage. Never ran into problems with the allocator functions in particular though. |
This "over-abstraction" allows software vendors to bend and change mysqlnd's behavior the way they it suits their needs. |
Also, tell the user to switch a flag or run the whole PHP binary under a profiler. Switch a flag and collect the information that can be then fed into a time series database and the health of the system can be traced, also anomaly detection is possible. |
There has not been any recent activity in this PR. It will automatically be closed in 7 days if no further action is taken. |
Also change one ZEND_DEBUG to PHP_DEBUG to be more consistent with the rest of the file
Another approach would be to change the
#if MYSQLND_DEBUG_MEMORY
to#if PHP_DEBUG
which could then clean-up some other preprocessor macros which enable more behaviour if we are in a debug build.