mIRC Home    About    Download    Register    News    Help

Print Thread
#263978 16/10/18 07:14 PM
Joined: Jul 2006
Posts: 4,180
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,180
Tested on a clean 7.52:

Quote:
//bset &binvar $calc(100*2^20) 65 | breplace &binvar 0 66 | hadd -bm table item1 &binvar | hadd -bm table item2 &binvar | echo -na => $hfind(table, /./, 1, r).data | hfree table
This makes mIRC jumps in memory usage from 10K to 700K, but after the script finishes, the memory usage only gets down to 200K.

After a while, doing nothing, the memory does get freed automatically at some point, but some weird things can be observed before that, executing a lot of $regex(a,a) definitely frees the memory.

Quote:
//var %a 1000 | while (%a) { noop $regex(a, a) | dec %a }
500 was enough for me, but it varies.

Remove $hfind from the execution and nothing strange happens.

Of course if you do this repeatedly, mIRC comes up with a memory allocation error, so I don't think there should be any delay when freeing memory here.

Also, there is a report about $hfind here https://forums.mirc.com/ubbthreads.php/topics/263124/ which has not been fixed, it does not seem to be an hard one to fix so I figured maybe it was forgotten, so I'm mentioning it here.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,486
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,486
Thanks for your bug report. This is due to the way mIRC manages its own pool of memory for strings. The memory is reused/freed across routines as needed. In this case, the string is allocated and resized/reused later on. That is why there is a delay. I have made a change in the next beta so that unlimited size strings, which can be allocated in routines relating to binary variable usage, are freed immediately.

Joined: Jul 2006
Posts: 4,180
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,180
Alright, thanks for the answer.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard