Closed Bug 669330 Opened 14 years ago Closed 13 years ago

Add static analysis check for the DOM Memory Reporter

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mounir, Unassigned)

References

Details

I think we could do something like: 1. Mark all classes participating to the DOM Memory Reporter; 2. Make sure these classes have a SizeOf() method; 3. Make sure this method call GetBasicSize() if the class inherits from something; 4. Mark attributes that are used to compute the size in SizeOf(); 5. Make sure that all attributes that should be used in SizeOf() are marked. Marking classes, could be done like NS_FINAL_CLASS or NS_STACK_CLASS. I'm not sure marking attributes in the declaration is a good idea because what we want to catch is new attributes being added and very likely some people will just copy-paste the mark. In addition, marking attributes in the declaration might be a bit heavy and annoying to read. I think what could be a better idea is to put something inside SizeOf() to tell to the static analyzer which attributes are actually used in the method.
BTW, this solution isn't going to catch situations where object owning change and I don't think there is a simple way to do that.
FWIW, DMD (bug 676724) is a dynamic analysis tool that does very similar things to this bug.
DMD seems like enough of a backstop check for this.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.