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.9k stars 298 forks source link

Rubberduck helped me trace a memory leak. Thanks! #4953

Open PGS62 opened 5 years ago

PGS62 commented 5 years ago

Hi there,

I've only recently discovered Rubberduck, though I've got many years' experience of VBA.

I have some code for solving systems of non-linear equations, which is a port (not by me) from Fortran of "MINPACK" (https://en.wikipedia.org/wiki/MINPACK). It works very well, but for ages I've known that it leaks memory (call it in an infinite While loop and use task manager to watch the memory leaking away).

I never got far with fixing that, and had to live with it. But Rubberduck's code inspection listed variables as not declared, which took me by surprise since it's all Option Explicit.

The problem was using Redim without first using Dim. Fixed that and the memory leak's gone :-)

So, Thanks!

Philip

PeterMTaylor commented 5 years ago

Awesome!

retailcoder commented 5 years ago

That's great feedback, thanks! Something to keep in mind when #2522 is closed: we will still want to warn about the possibility of a memory leak even when we pick up a ReDim declaration as a declaration - that inspection result for an undeclared variable is currently considered a false positive!