Valhalla Legends Forums Archive | Battle.net Bot Development | out of memory?!?

AuthorMessageTime
FiReGoD
what causes this to happen, i leave my bot on while i am at school, out of memory when i get home, same with if i  leave it on over night?

is it beause the textbox is full or ??
February 25, 2003, 7:45 AM
iago
If it's in C++, look for a malloc() or new without a free() or delete.

But seriously, text filling your entire memory is unlikely.  More likely it's something stupid, but I'm not really sure how to create a memory leak in vb without allocating massive arrays inside a loop or something..
February 25, 2003, 8:43 AM
Yoni
Win9x? VB? Using a text box and not a rich edit box?

If you answered "Yes" to three or more of the above questions, change whatever details to turn at least one of the answers to "No".
February 25, 2003, 9:59 AM
Tuberload
In VB of you are using a rich text box you will run out of memory eventualy. It happened to me all the time when I atempted to make a "good" bot with it. Just make an option to delete it after so many lines.
February 25, 2003, 12:39 PM
Skywing
[quote]In VB of you are using a rich text box you will run out of memory eventualy. It happened to me all the time when I atempted to make a "good" bot with it. Just make an option to delete it after so many lines.[/quote]
Perhaps the best solution is to just remove lines off the top of your chat output control after so many lines are present.  Clearing the entire contents tends to inconveniently delete stuff you might have wanted to read.
February 25, 2003, 1:58 PM
Atom
yes it is most likely caused by the Rich Text Box control, this is how flood bots work in crashing ops bots. Basically what you could do is somethin like

rtb.text = right(rtb.text,777)
on the rtb's change event or something similair
February 25, 2003, 3:46 PM
iago
777 is probably too short..
February 25, 2003, 4:16 PM
Spht
[quote]
rtb.text = right(rtb.text,777)
on the rtb's change event or something similair[/quote]

Wouldn't that end up truncating a section of the top line in most cases? What I do, is after the chat window reaches 2000 lines, I remove the top line each time a new line message is added. Thereby maintaining a constant amount of maximum lines on the chat window.
February 25, 2003, 4:25 PM
haZe
Stealth bot does something..Saves the text after so many lines to a .txt file and clears the window.
Spht, how would you do that?
February 25, 2003, 4:34 PM
Spht
[quote]
Spht, how would you do that?[/quote]

I use EM_GETLINECOUNT message to get amount of lines, then just strip the top line if return is 3000.
February 25, 2003, 5:00 PM
FiReGoD
spht, can you explain how to do this?

and yes its in vb
February 25, 2003, 5:04 PM
haZe
Search results from search.microsoft.com

thats the search for it, you'll get a few different results.

Edit by Skywing: Fixed link to not completely break forum spacing.  In the future, please refrain from posting things which kill the layout.  Thanks...
February 25, 2003, 5:28 PM
Camel
it has to do with the textbox control being full of crap in vb. i've seen it before, and theres not a whole lot you can do about it because vb apps dont like you touching their memory. the best thing you can do is make sure that the ammount of text in your box doesnt go past a certain ammount of text...
instead of text1.text = text1.text & mytext, try:

text1.text = right(text1.text, MAXLEN - len(mytext))
text1.text = text1.text & mytext

you might think it would be simpler to do = right(text1.text & mytext, MAXLEN), but that is sort of liek changing MAXLEN to MAXLEN+len(mytext) because text1.text and mytext are combined before being chopped off.



iago, i'm pretty sure there are some good classes round on the internet that will automaticly handle that for you. the idea is put a rediculously long timer on how long a variable should be allocated, like 2 seconds =P, and if it isn't free()d by then, print a bunch of nasty crap with info about where the memory was allocated -- __FILE__ and __LINE__. of course, you would only want that code to be in debug builds..i would define a macro so that it does the debug code for debug builds, and just calls malloc() directly for releases
btw, i'm not dismissing what you said, just suggesting a way that would majorly help find the problem
February 25, 2003, 7:04 PM

Search