Graal Forums  

Go Back   Graal Forums > Graal V6 forums > Bug Report
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-11-2010, 06:25 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Temporary TStaticVars & Classes

Serverside temporary TStaticVars are not being cleared from memory apparently.

Example:
PHP Code:
function myFunc() {
  
temp.= new TStaticVar();
  
temp.v.join("myclass");
  
sleep(0.1);
  return 
temp.v;

After this function is called, the temp.v stays in memory and doesn't appear to get destroyed. This is a big problem for me.

This also shows an example of my other issue. After you join something to a class, you have to sleep to wait for it to load. It would be very very nice if it would stop the stream to let the class load, since I'm sure it loads faster than 0.1 seconds.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #2  
Old 10-11-2010, 12:26 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Tigairius View Post
Serverside temporary TStaticVars are not being cleared from memory apparently.

Example:
PHP Code:
function myFunc() {
  
temp.= new TStaticVar();
  
temp.v.join("myclass");
  
sleep(0.1);
  return 
temp.v;

After this function is called, the temp.v stays in memory and doesn't appear to get destroyed. This is a big problem for me.
In your example why would you want it cleared from memory? It seems like you are trying to return a reference to be used elsewhere.

I'm guessing this is expected behaviour; TStaticVars will probably be allocated on the heap and not the stack, and sending a reference to it by return is probably instructing the garbage collector to preserve it in memory because it's expected lifetime is no longer clear (i.e. now the object is expected to outlive the function execution). In scenarios like this, you are normally expected to destroy an object yourself when you are finished with it since it is difficult for the garbage collector to determine whether you still want it or not.
__________________
Skyld
Reply With Quote
  #3  
Old 10-11-2010, 06:10 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
The TStaticVar will be destroyed once no one else is referencing the object anymore. A reference in a temp.var is still a reference. It's automatically detecting 'circle references'.
Reply With Quote
  #4  
Old 10-11-2010, 07:17 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Skyld View Post
In your example why would you want it cleared from memory? It seems like you are trying to return a reference to be used elsewhere.

I'm guessing this is expected behaviour; TStaticVars will probably be allocated on the heap and not the stack, and sending a reference to it by return is probably instructing the garbage collector to preserve it in memory because it's expected lifetime is no longer clear (i.e. now the object is expected to outlive the function execution). In scenarios like this, you are normally expected to destroy an object yourself when you are finished with it since it is difficult for the garbage collector to determine whether you still want it or not.
Quote:
Originally Posted by Stefan View Post
The TStaticVar will be destroyed once no one else is referencing the object anymore. A reference in a temp.var is still a reference. It's automatically detecting 'circle references'.
Hmm, I think I see what you are saying. I'll have to destroy it elsewhere. But what about the issue with joining classes? Is there any way this could be addressed?
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #5  
Old 10-12-2010, 12:22 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Tigairius View Post
Hmm, I think I see what you are saying. I'll have to destroy it elsewhere. But what about the issue with joining classes? Is there any way this could be addressed?
This really does need to be addressed. When joining objects to classes they should really know about it instantly instead of having to use a sleep.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:39 AM.


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