Flush() and CollectGarbage()
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Flush() and CollectGarbage()

Started by TTB, 27 May, 2005, 19:46:36

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TTB

Hi,

I have a problem. My script is taking to much memory, and I think it is because I don't use Flush() and CollectGarbage(). So here is also my question: What does it really do, and when is it useful?

My script is taking 300 Mb memory after 3 days running (not g00d).

Some help would be appriciated (links to info sites also).
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

Pothead

Flush writes stuff it got in memory to files.  Should use this often.
CollectGarabage free's all the memory which isn't needed anymore.  This should also be used quite often. :)

TTB

QuoteOriginally posted by Pothead
Flush writes stuff it got in memory to files.  Should use this often.
CollectGarabage free's all the memory which isn't needed anymore.  This should also be used quite often. :)

"Flush writes stuff it got in memory to files." I don't get this. So flush writes data in files? Maybe someone can give an example, I don't get it very well...

The CollectGarbage() should I use after deleting data from the temp tables? And can it erase data what is still needed?
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

??????Hawk??????

function Clear() 
	collectgarbage();io.flush();
end

i call this every 5 mins  ...   Maby a bit of an over kill  But  works :P  :P

TTB

Hi, I will try that. I hope it will work with my huge script... Thanx  :D
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

Pothead

QuoteOriginally posted by TTB
"Flush writes stuff it got in memory to files." I don't get this. So flush writes data in files? Maybe someone can give an example, I don't get it very well...
It saves some information in memory which will be written to files when the script stops / ptokaX closes.  Flush forces it to dump this information into the files, and outta the memory.

SMF spam blocked by CleanTalk