Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Topaz on August 25, 2005, 08:39 PM

Title: Memory Leaks
Post by: Topaz on August 25, 2005, 08:39 PM
My bot that I'm currently coding is experiencing memory leaks, or at least, that's what I think. :P It was 2,000k before, and it's done a nice leap to about 7,000k :-/

So, in short, I'd like for you guys to post what you know ( Possible places/reasons why it's leaking, or methods for me to find and kill them )

Note: I do use Option Explicit, and I don't set objects to Nothing after using them.
Title: Re: Memory Leaks
Post by: R.a.B.B.i.T on August 25, 2005, 09:40 PM
Check your arrays ;\
Title: Re: Memory Leaks
Post by: R.a.B.B.i.T on August 25, 2005, 10:56 PM
Adding stuff repeatedly, bad methods of checking, not properly deleting data, etc...  IE: If you have a string array of users, and one leaves, you remove that data from the array (data(50) = "" or whatever), but the space is still allocated, so each time you add a new user, you're allocating more space, even though you may not need to.
Title: Re: Memory Leaks
Post by: Eric on August 25, 2005, 11:09 PM
Unless the overall memory usage is slowly increasing then it's probably not a memory leak, rather just poor coding.
Title: Re: Memory Leaks
Post by: Topaz on August 25, 2005, 11:11 PM
Examples of how this could happen? It might just be me :(
Title: Re: Memory Leaks
Post by: UserLoser. on August 25, 2005, 11:11 PM
Quote from: LoRd[nK] on August 25, 2005, 11:09 PM
Unless the memory is slowly increasing in memory usage then it's probably not a memory leak, rather just poor coding.

Or poor coding which leads to memory leaks
Title: Re: Memory Leaks
Post by: UserLoser. on August 25, 2005, 11:12 PM
Quote from: Topaz on August 25, 2005, 11:11 PM
Examples of how this could happen? It might just be me :(

Not closing handles, threads, deleting objects, freeing up arrays, etc. when you're done with them
Title: Re: Memory Leaks
Post by: R.a.B.B.i.T on August 26, 2005, 01:23 AM
It could possibly be 3rd party ActiveX controls you're using as well.
Title: Re: Memory Leaks
Post by: Topaz on August 26, 2005, 10:27 AM
What sort of things (attributing to poor coding) would suck up a lot of memory?
Title: Re: Memory Leaks
Post by: UserLoser. on August 26, 2005, 03:38 PM
Quote from: Topaz on August 26, 2005, 10:27 AM
What sort of things (attributing to poor coding) would suck up a lot of memory?

Not closing handles, threads, deleting objects, freeing up arrays, etc. when you're done with them
Title: Re: Memory Leaks
Post by: Grok on August 30, 2005, 11:55 PM
Quote from: Topaz on August 25, 2005, 08:39 PM
and I don't set objects to Nothing after using them.

Why not?  Depending on your scoping and object creation, that could be your problem.  What type of objects?