Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   rungarbagecollector() (https://forums.graalonline.com/forums/showthread.php?t=80084)

Googi 06-15-2008 07:19 AM

rungarbagecollector()
 
I was checking out a list of functions and came across this interestingly named one. Anyone know what it does?

cbk1994 06-15-2008 07:33 AM

Runs the garbage collector.

In Java, that means that it will go through and clear out all of the unused variables.

For example,
PHP Code:

function onCreated()
{
  
temp.foo = new TStaticVar();
  
foo.lolwat 32;


temp.foo is not immediately destroyed once the onCreated function ends. Instead, the garbage collector comes and destroys it to clear memory.

So, in theory, to destroy something, remove all references to it.

PHP Code:

temp.foo = new TStaticVar();
temp.foo null

temp.foo no longer points to the TStaticVar created, so it will be destroyed.

This thread might help a bit as well:

http://forums.graalonline.com/forums...hlight=garbage

Quote:

Originally Posted by Stefan
When you assign a TStaticVar to a normal variable, then only a link to the TStaticVar is remembered. When there is no link to a TStaticVar anymore, then the variable will be deleted on the next run of the garabage collector.

Stefan said that in that thread, which is a bit easier to understand that what I said.


All times are GMT +2. The time now is 04:58 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.