![]() |
Temporary TStaticVars & Classes
Serverside temporary TStaticVars are not being cleared from memory apparently.
Example: PHP Code:
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. |
Quote:
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. |
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'.
|
Quote:
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 10:23 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.