Memory Management for nsIScriptContext: Difference between revisions

m
sp
(Update to current thinking and decisions by Brendan.)
m (sp)
Line 28: Line 28:
* Having performance critical code keep a reference to the nsILanguageRuntime.
* Having performance critical code keep a reference to the nsILanguageRuntime.


Even still, a key problem to this approach remains its fragility.  By explicitly requiring manual Drop/Hold calls, there is alot of scope for programmer error in the face of error conditions (ie, early returns) to cause difficult to track leaks.  The inevitability of such errors is evidenced by nsCOMPtr and various other tricks already in the code base.
Even still, a key problem to this approach remains its fragility.  By explicitly requiring manual Drop/Hold calls, there is a lot of scope for programmer error in the face of error conditions (ie, early returns) to cause difficult to track leaks.  The inevitability of such errors is evidenced by nsCOMPtr and various other tricks already in the code base.


== Implementation idea #2 ==
== Implementation idea #2 ==
Line 98: Line 98:
== Notes ==
== Notes ==


Implementation idea #2 has been implemented and works well.  However, concerns exist regarding the performace overhead in terms of speed and bloat.
Implementation idea #2 has been implemented and works well.  However, concerns exist regarding the performance overhead in terms of speed and bloat.
5

edits