Release memory used by array (or table)
 

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

Release memory used by array (or table)

Started by Neo, 12 November, 2003, 17:16:34

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Neo

Hi guys...
I've a little little problem:
I use in my userinfo scripts some tables. Now:
Start hub-->memory=256K
Running-->memory=6000-8000 Kb

During run i don't need all of theese tables and i want to discard them...but HOW?? ?(  ?(  ?(

I've tried to re-initialize them (tablename={}) but memory is not released...

Please help me...

Thanks in advance!!

Bye!
(Sorry for my bad english!!)

-->ITA The Matrix Hub<--
->maxstorm.no-ip.com<-

pHaTTy

pretty much a guess but have you tried to give it a nil input, works with some other laguages

tablename={nil}
Resistance is futile!

Optimus

well maybe this helps abit, duno for sure if it's what you looking for...

Code:

function Clear()
   collectgarbage()
   flush()
end

pHaTTy

thats what i use for my function OnExit()
Resistance is futile!

NightLitch

So How would a correct function look like then if I want
to emty the table...

I have same table in every userfile

so when loading one and then another one above first should be overwritten right???

Or is it a way to clear the data in memory when usercommand is used???

This was a nice thread... Got me open my eyes... hehe...

/NightLitch
//NL

c h i l l a

i thaught table = {}  is enough, and the garbage collector will do the rest by time ? or not?

Optimus

but if C: & T: are getting high then this is a nice trick to refresh them without restarting script or loosing any data... If i'm explaining this correctly. Think it can be done in some more words

So there for i say it helps -->> A Bit <<---

But maybe there are some more tricks... really like to know them then?

pHaTTy

hmmmmm well in that case


you cud add this function to the bot

function Clear() 
anytableyuwannaclear = {}
andvaribaletoclear = nil
collectgarbage() 
flush() 
end

then ontimer or whereer add

function OnTimer()
Clear()
end

thats how my flush works
Resistance is futile!

Neo

QuoteOriginally posted by c h i l l a
i thaught table = {}  is enough, and the garbage collector will do the rest by time ? or not?

YESSS!!
I've used first only Clear()...and nothing...
then i've used table={} and Clear() and it's OK!!
THANKS TO ALL!!! :D
(Sorry for my bad english!!)

-->ITA The Matrix Hub<--
->maxstorm.no-ip.com<-

SMF spam blocked by CleanTalk