Raised This Month: $51 Target: $400
 12% 

Dynamic Objects and Properties - v.0.0.32 - [2018.05.08]


Post New Thread Reply   
 
Thread Tools Display Modes
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 01-20-2017 , 17:26   Re: Dynamic Objects and Properties - v.0.0.23 - [2016.12.30]
Reply With Quote #191

Nice. Looks bloody expensive for those who run massive plugin counts.

Was thinking of adding something like: Dynamic.DisposePluginObjects() which a plugin could call on OnPluginEnd to clean it's trash.

Registering a library is a much cleaner fix.

OnPluginUnload(Handle plugin) would be the best.
__________________

Last edited by Neuro Toxin; 01-20-2017 at 17:27.
Neuro Toxin is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-21-2017 , 06:32   Re: Dynamic Objects and Properties - v.0.0.23 - [2016.12.30]
Reply With Quote #192

Quote:
Originally Posted by Neuro Toxin View Post
You could also .Dispose your Dynamic objects OnPluginEnd
This is the sane and correct thing to do, and why OnPluginEnd exists.
__________________
asherkin is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 01-21-2017 , 12:20   Re: Dynamic Objects and Properties - v.0.0.23 - [2016.12.30]
Reply With Quote #193

Would still error out if the plugin calls SetFailState after creating some dynamic objects
__________________
Peace-Maker is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 01-21-2017 , 16:57   Re: Dynamic Objects and Properties - v.0.0.23 - [2016.12.30]
Reply With Quote #194

I think a failed state is ok as GetPluginStatus has a status for this and the handle isn't yet destroyed until it's unloaded.

My issue GetPluginStatus errors on a plugin handle that has been completely unloaded.
__________________
Neuro Toxin is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 01-23-2017 , 14:38   Re: Dynamic Objects and Properties - v.0.0.23 - [2016.12.30]
Reply With Quote #195

Quote:
Originally Posted by Peace-Maker View Post
Would still error out if the plugin calls SetFailState after creating some dynamic objects
IForwardSys is your friend here. If you create a private forward in pawn, register the forward, then GetFunctionCount() you get a super cheap, protected check. If there's 0, you know your friend, has unloaded. This is what I did for my pawnhooks ext.
KyleS is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 01-23-2017 , 16:03   Re: Dynamic Objects and Properties - v.0.0.23 - [2016.12.30]
Reply With Quote #196

Do the plugins have to implement the forward for GetFunctionCount to count them?
__________________
Neuro Toxin is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 01-23-2017 , 16:10   Re: Dynamic Objects and Properties - v.0.0.23 - [2016.12.30]
Reply With Quote #197

Quote:
Originally Posted by Neuro Toxin View Post
Do the plugins have to implement the forward for GetFunctionCount to count them?
No. You create a private forward, AddToForward, and you're done. You have a private forward handle to the plugin that you can use to call their functions. From the parent, you can then GetFunctionCount them to see if they're still loaded before calling their functions. It's a round-the-bout way, but it got me there years ago when I had a similar problem that needed solving.
KyleS is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 01-23-2017 , 16:27   Re: Dynamic Objects and Properties - v.0.0.23 - [2016.12.30]
Reply With Quote #198

Oh.

So I could make my plugin reference (dynamic.OwnerPlugin) a forward handle and add the plugin to it and if the count is 0 the plugin has unloaded.
__________________
Neuro Toxin is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-23-2017 , 16:29   Re: Dynamic Objects and Properties - v.0.0.23 - [2016.12.30]
Reply With Quote #199

Quote:
Originally Posted by Neuro Toxin View Post
Oh.

So I could make my plugin reference (dynamic.OwnerPlugin) a forward handle and add the plugin to it and if the count is 0 the plugin has unloaded.
Yes.
__________________
asherkin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 01-23-2017 , 16:36   Re: Dynamic Objects and Properties - v.0.0.23 - [2016.12.30]
Reply With Quote #200

The only thing I dont like about this is the use of an additional Handle.

SM allows approx 32k Handles. Dynamic uses 2 per object (lookup Trie and data ArrayList). Adding another Handle really cuts into the max objects that can be created by plugins.

Edit:

I could probably cache one Handle per plugin to avoid one new additional Handle for each .OwnerPlugin
__________________

Last edited by Neuro Toxin; 01-23-2017 at 16:37.
Neuro Toxin is offline
Reply



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 -4. The time now is 16:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode