Consulting

Results 1 to 3 of 3

Thread: Solved: check if variables released

  1. #1
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    291
    Location

    Solved: check if variables released

    Is there an easy way at the end of code to look at all the variables used in your code and check they have been released

    I read about memory leak recently and I am getting paranoid

  2. #2
    VBAX Contributor
    Joined
    Jan 2007
    Posts
    146
    Location
    just set all of them equal to nothing at the end of the code, not the middle. That way you have all your declaration up top and can compare your object destructors at the end

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    If it is string/long/double etc. type variables tere is not a lot that you can do. You can reduce string memory consumption by setting to "" or Empty, but setting a long to say 0 is the same as setting it to 123456789.

    Objects are different, and if you don't trust VBA garbage cleanup, then just set each object that you declare to Nothing before exiting the procedure within whose scope the object is declared.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •