[OpenSIPS-Devel] How to allocate and reliable free memory?

Roger Schreiter roger at planinternet.de
Thu Jun 23 13:59:52 CEST 2011


Hello,

how do I allocate and reliable free some memory I need
for parsing some SIP body?

Is the following the correct way?

- allocate in the module child init function or later
  in some function called by the configuration.

- That memory will be thread safe, since it is created
  once per fork, and per fork there is only one sip_msg
  handled at once

- My module destroy function is called per fork and thus will
  be able to free the alloced memory.


Please give me some hint!

Roger.


P.S.
In "struct part" (parser/parse_multipart) there is
a member "void * parsed_data".
Is it maybe intended (in future) for an automatic
freeing of allocated memory like the various fields in
"struct sip_msg"?




More information about the Devel mailing list