rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.92k stars 302 forks source link

OutOfMemoryException during code inspections #5489

Open DaveInCaz opened 4 years ago

DaveInCaz commented 4 years ago

Rubberduck version information Version 2.5.0.5244 OS: Microsoft Windows NT 6.2.9200.0, x64 Host Product: Visual Basic x86 Host Version: 6.00.9782 Host Executable: VB6.EXE

Description Loaded a VB6 project group with 6 projects and then ran Code Inspections. It ran for a few minutes (GUI unresponsive) and then produced the exception below.

Let me know if there is any other specific information I can provide.

Thanks

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Security.CodeAccessSecurityEngine.CheckNReturnSO(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 create)
   at System.Security.CodeAccessSecurityEngine.Assert(CodeAccessPermission cap, StackCrawlMark& stackMark)
   at System.Security.CodeAccessPermission.Assert()
   at System.Windows.Forms.Control.ActiveXImpl.System.Windows.Forms.IWindowTarget.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
daFreeMan commented 4 years ago

Please ensure that Rubberduck is set to Trace level logging, and attach the RD log (you can open the log folder from the Rubberduck | About menu.

Also, very likely to be related to #3347 (if not a dupe).

retailcoder commented 4 years ago

Try disabling all inspections (set each one's severity level to "do not show"...a tool to do this automatically would be nice); assuming the OOM is caused by too many results (100+ inspections each potentially yielding hundreds of results quickly makes a lot of in-memory objects) and not merely the parse trees and associated metadata.

Top candidate inspections for most results produced typically include:

Inspections can then be re-enabled one at a time, results reviewed/fixed/ignored at any pace you like; note that both use meaningful names and Hungarian notation inspection can be configured to "white-list" specific identifiers and prefixes, such that only identifier names that aren't white-listed get flagged.