[asterisk-users] Macro vs sub

Sammy Govind govoiper at gmail.com
Thu Jan 19 00:14:10 CST 2012


Hi, why don't you try write two macros only and recursively call both of
them incrementing a counter each time you call the inner macro. Also
print(NOOP) system stats along with the counter. You'll soon see what
happens.

The para Matthew quoted is cent percent true. But if you don't  need to
call macros within macros and do kind of recursove macro calling then you
can continue using macros safely.

Its not that I never use macros at all, I only use where I know I'll get in
macro and safely exit without going any deeper within the dial-plan.

On Wed, Jan 18, 2012 at 6:41 PM, Jonas Kellens <jonas.kellens at telenet.be>wrote:

> On 01/18/2012 01:51 PM, Matthew Jordan wrote:
>
>> Anyone else ? Maybe one of the developers can confirm this risk of
>>> working with macros ?
>>>
>> I don't think you need an Asterisk developer to tell you the risks of
>> using macros in deeply nested situations.  Quoting the documentation of
>> Macro:
>>
>> "Because of the way Macro is implemented (it executes the priorities
>> contained within it via sub-engine), and a fixed per-thread memory stack
>> allowance, macros are limited to 7 levels of nesting (macro calling macro
>> calling macro, etc.); It may be possible that stack-intensive applications
>> in deeply nested macros could cause asterisk to crash earlier than this
>> limit. It is advised that if you need to deeply nest macro calls, that you
>> use the Gosub application (now allows arguments like a Macro) with explict
>> Return() calls instead."
>>
>
> How would I notice that this is really the case here ?
>
> I should see the RAM-memory spike on the server ? I do not see this...
>
> Webmin says : 3.83 GB total, 375.51 MB used
>
>
>
> Kind regards,
>
> Jonas.
>
>
> --
> ______________________________**______________________________**_________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>              http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>  http://lists.digium.com/**mailman/listinfo/asterisk-**users<http://lists.digium.com/mailman/listinfo/asterisk-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120119/4b827513/attachment.htm>


More information about the asterisk-users mailing list