[Asterisk-code-review] MALLOC DEBUG: Always use the API. (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Thu Feb 22 11:41:03 CST 2018


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/8366 )

Change subject: MALLOC_DEBUG: Always use the API.
......................................................................


Patch Set 1:

(2 comments)

> (1 comment)
 > 
 > This may be crazy but how much of a performance hit would we take
 > if __ast_calloc et al were always real functions provided by
 > main/astmm.c instead of AST_INLINE_API in utils.h?  Then just have
 > the implementation of main/astmm.c chosen by `#if defined(MALLOC_DEBUG)`.
 >  I know there would be a hit, I'm just not sure it's prohibitive.

I'd like to do that since it would reduce the inline code bloat.  However,
something would need to be done about the varying definitions of
MALLOC_FAILURE_MSG.  That would need to be another patch though.

I do think we overuse inline functions.  They are supposed to provide
benefit when the overhead of calling a function is more than the
time needed to execute the function itself.  This means that inlined
functions should be tiny.  e.g., Value accessor functions.

https://gerrit.asterisk.org/#/c/8366/1/include/asterisk/utils.h
File include/asterisk/utils.h:

https://gerrit.asterisk.org/#/c/8366/1/include/asterisk/utils.h@536
PS1, Line 536: #define ast_free free
> Wouldn't this still be a problem if MALLOC_DEBUG is enabled on the core and
You did notice the comment about 10 lines above right?

"Need to defeat the MALLOC_DEBUG API when building the standalone utilities."

This section of code is only present when we are building those deservedly maligned applications in the utils directory.


https://gerrit.asterisk.org/#/c/8366/1/include/asterisk/utils.h@536
PS1, Line 536: #define ast_free free
> Looking further this is a problem:
I don't understand what you are trying to say here.  This code is only present when we are building the standalone applications in the utils directory.



-- 
To view, visit https://gerrit.asterisk.org/8366
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic07ad80b2c2df894db984cf27b16a69383ce0e10
Gerrit-Change-Number: 8366
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Thu, 22 Feb 2018 17:41:03 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180222/53ce05a0/attachment.html>


More information about the asterisk-code-review mailing list