[Devel] Memory woes

Daniel-Constantin Mierla daniel at voice-system.ro
Wed Jan 31 15:44:46 CET 2007


Hello Bastian,

most of the functions in openser config do not have same values in 
parameters all the time. The fixup is required to convert the string to 
something else, that will be evaluated at runtime. For example:

xlog("this is r-ruri $ru");

is fixed at startup, to a list of elements that contains references to 
text for 'his is r-ruri ' and reference to a function that returns r-uri 
for '$ru'.

If you want to call xlog() from another module, you have to give the 
list of elements as parameter, not the initial string. Perhaps 
destroy_fixup function is a good solution, but will take a lot of time 
and we have no much till freezing.

One solution by now is to disable calls to functions exported by 
modules. I see no much benefit as long as they can be executed directly 
in configuration file. Access and management (rewrite uri, dst uri, 
...)  sip_msg structure plus ability to set/get AVPs would be most of 
what one would like to do in PERL applications.

Cheers,
Daniel


On 01/30/07 21:07, Bastian Friedrich wrote:
> Hi,
>
> On Tuesday 30 January 2007 19:25, Daniel-Constantin Mierla wrote:
>   
>> how do you do the fixup for exported functions? At statup, or every time
>> you call a function from Perl? In the second case, it is tough, because
>> after a fixup, the new parameter value can be a structure or something
>> else, and it is not easy to free. The best is to do it once, at startup
>> or at first execution, and then reuse it, if possible.
>>     
>
> Houston, we've got a problem. :(
>
> Unfortunately, a perl script can - and commonly will - never use the same set 
> of parameters twice for a call to the same function. Imagine something like 
> this:
> ====================
>
>
> sub foo {
>   my $msg = shift;
>
>   my $ruri = $msg->getRURI();
>
>   $msg->xlog(..., "I'm processing a call to $ruri");
>
>   return 1;
> }
> ====================
>
> This means that everytime xlog is called, the fixup for
> "... $ruri" has to be found - and $ruri is not even remotely static. Doing the 
> fixup only once is thus not possible.
>
>
> I'd like to propose the following concept:
>
> - Add a "cleanup" function pointer to action_elem_t
> - Let every (!) fixup function in all modules set a pointer to a function that
>   does the cleanup.
>   * This could be NULL, e.g. where the fixup'd data is an integer
>     (e.g. sl_send_reply)
>   * A pointer to pkg_free(), where fixup'd data is a string
>   * A pointer to a newly written function that cleans up structures for more
>     hierarchic data structures
> - the perl module could then call this "cleanup" function after processing.
>
>
> Yes. I know. It's not nice, but the whole concept of fixup functions is in the 
> way in the context of the perl module.
>
> Sorry for the mess; my patch from today probably (no, definitely!) does _not_ 
> do things right. Unfortunately, there's a conceptual problem that is not 
> easily solvable at this point.
>
> I hope you understood my concerns. Maybe you can come up with a better 
> solution :)
>
> Best regards,
>    Bastian
>
>   



More information about the Devel mailing list