[Bro] Returning local variables and garbage collection
sullivan at cs.ucsb.edu
Mon Jul 27 11:24:19 PDT 2009
On Mon, Jul 27, 2009 at 10:39:31AM -0700, Robin Sommer wrote:
> > Or, is the object the same and just internal refcnt are increased or
> > decreased? If so, it shouldn't really make any difference as refcnt
> > should be going to 0 after X finishes.
> This is indeed what happens. Non-atomic objects are passed around as
> references, with reference counts adjusted as necessary.
This is what I was thinking, so there shouldn't be any problem.
> to do is running with profiling.bro, that will let Bro generate a
> file prof.log with various memory statistics. Feel free to send me
> the output if it's too cryptic.
Perfect, thanks. I'm actually returning "custom" type, i.e., those
for which Bro doesn't know anything about, internally. That is, there
are no corresponding RecordVal declaration nor "initialization" by
means of internal_type("...")->AsRecordType(). Could Bro mess things
up if those are missing?
In addition, the memory consumption lowered down when I removed the
handler for connection_timeout (my code is called when a bunch of
connection_* events are triggered). However, I just suppose this
happens because less events of this type are raised.
> P.S.: Are you creating any cyclic reference structures?
I don't think so, but I'll double check.
Lorenzo `Gigi Sullivan' Cavallaro <sullivan at cs.ucsb.edu>
GPG key at http://www.cs.ucsb.edu/~sullivan/sullivan.asc
Until I loved, life had no beauty;
I did not know I lived until I had loved. (Theodor Korner)
See the reality in your eyes, when the hate makes you blind. (A.H.X)
More information about the Bro