Is object clearing/array deallocation really necessary in VB6/VBA (Pros/Cons?)

前端 未结 5 2493
暗喜
暗喜 2021-02-20 12:33

A lot of what I have learned about VB I learned from using Static Code Analysis (Particularly Aivosto\'s Project Analyzer). And one one of things it checks for is whether or not

5条回答
  •  死守一世寂寞
    2021-02-20 13:23

    I always do it for good practice, you never know what an exception might do if you fall in one and your objects are not deallocated. You should relase them in finally statements and ensure they are not using any memory otherwise you may run into a memory leak.

    I had an issue inside of a simple time off tracker system where the server kept on crashing randomly, it took weeks to determine it was a memory leak of an object that was supposed to self destruct on its own. My code was being thrown into an exception and never cleaned up after itself causing the server (the actual web site not the entire server) to go down.

提交回复
热议问题