• Welcome to Valhalla Legends Archive.
 

out of memory?!?

Started by FiReGoD, February 25, 2003, 01:45 AM

Previous topic - Next topic

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 ??

iago

#1
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..
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Yoni

#2
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".

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.
Quote"Pray not for lighter burdens, but for stronger backs." -- Teddy Roosevelt
"Your forefathers have given you freedom, so good luck, see you around, hope you make it" -- Unknown

Skywing

#4
QuoteIn 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.
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.

Atom

#5
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
I am back! aINC is dead, ThinkTank PRO is alive.
VB, JAVA, ASM, C, its all yummy to me.

iago

#6
777 is probably too short..
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Spht

#7
Quotertb.text = right(rtb.text,777)
on the rtb's change event or something similair

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.

haZe

hmm
#8
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?

Spht

#9
QuoteSpht, how would you do that?

I use EM_GETLINECOUNT message to get amount of lines, then just strip the top line if return is 3000.

FiReGoD

#10
spht, can you explain how to do this?

and yes its in vb

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...

Camel

#12
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