Peter Mogensen
2011-Aug-04 20:11 UTC
[Dovecot] Question about memory management in plugins
Hi, I've writing an passdb/userdb plugin (see my previous question about a plugin authenticating via a UNIX socket protocol). Now... the protocol spoken over this socket is JSON-based and I'm using a SAX-like event based parser which maintains a parse context between callbacks. Now... I'm a little bit in doubt about which dovecot memory management method would be best for data in this parser context. Alloc-only pools seems wrong cause the parser object is used as long as the connection is open and there might run many auth requests over the connection before it's freed making the pool grow for long time. Data stack allocation won't work either, since with all this async network and callbacks, there's really no where to place the stack frame. So I end up using i_* and i_free for all data during the lifetime of the connection. Is there a better way? If I could only free my pool-allocated data, but I can't since it's almost never the last allocated data I want to free. /Peter
Peter Mogensen
2011-Aug-04 20:39 UTC
[Dovecot] Question about memory management in plugins
On 2011-08-04 22:11, Peter Mogensen wrote:> Is there a better way?Maybe I can answer my own question... It dawns upon me that auth_request comes with it's own pool, which of probably should be used for allocations temporary to one passbd/userdb lookup. /Peter