[Bro-Dev] #831: Memory leak in print

Bro Tracker bro at tracker.bro-ids.org
Mon Jun 11 13:00:35 PDT 2012


#831: Memory leak in print
----------------------+------------------------
  Reporter:  amannb   |      Owner:
      Type:  Problem  |     Status:  new
  Priority:  High     |  Milestone:  Bro2.1
 Component:  Bro      |    Version:  git/master
Resolution:           |   Keywords:
----------------------+------------------------

Comment (by jsiwek):

 What's happening is the reference to `rec$md5` does not first check
 whether that optional field is initialized (e.g. `rec?$md5`), so when it
 isn't, an internal `InterpreterException` gets thrown and there's no
 cleanup of heap allocations during the stack unwind.  I'm not sure that
 catching, cleaning up allocated resources, and rethrowing that exception
 every place it can occur is going to be the greatest way to fix this.
 E.g.  currently that exception only gets thrown from a couple
 implementations of `UnaryExpr::Fold`, but that's called from a couple
 implementations of `Expr::Eval`, which maybe used in ~70 places, then
 still the callers of those places also potentially need to handle the
 exception to do cleanup, etc.

 Would it be better to wait and fix this through overhauling memory
 management to use smart pointers?  That's planned, right?  Any script that
 tries to reference a missing field should be corrected, anyway (these
 errors are logged in reporter.log).

-- 
Ticket URL: <http://tracker.bro-ids.org/bro/ticket/831#comment:3>
Bro Tracker <http://tracker.bro-ids.org/bro>
Bro Issue Tracker



More information about the bro-dev mailing list