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

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 10-09-2016 , 01:40   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #151

This was implemented some time ago.

https://github.com/ntoxin66/Dynamic/...etting-Objects

This wiki is not yet complete. However player settings are accessed by .GetPlayerSettings
__________________
Neuro Toxin is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 10-09-2016 , 19:38   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #152

Quote:
Originally Posted by Neuro Toxin View Post
This was implemented some time ago.

https://github.com/ntoxin66/Dynamic/...etting-Objects

This wiki is not yet complete. However player settings are accessed by .GetPlayerSettings
Okay cool, thanks so much
headline is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 10-10-2016 , 03:45   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #153

Be aware player settings objects dispose on post client disconnect
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 11-10-2016 , 17:39   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #154

Thanks a bunch a for feedback abrandnewday.

On the database topic. I have started a Dynamic database table adapter (DTA). It basically extends a Collection methodmap around a MySQL table.

Basically each row in a table represents a Dynamic index in the Collection. It takes advantage of member hooks and then runs queries to update the database automatically when Dynamic members are changed.

Internally you parse a database tablename and which column name is the primary key to the adapters constructor. The adapter pulls the table fields and stores type definitions for each member. You then call GetObject with a primary key value to pull a row or sync the entire table to dynamic memory.
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 11-10-2016 , 22:19   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #155

Hooking member changes.

https://github.com/ntoxin66/Dynamic/...basics.sp#L158
__________________
Neuro Toxin is offline
dubbeh
Senior Member
Join Date: Jul 2007
Old 11-17-2016 , 19:05   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #156

Hey Neuro Toxin,

Just a quick question about the latest Dynamic.

Got a report today about someone hitting the hard handles cap within SourceMod (Using Radio). Wondering if you think It's related to storing too much information in the method maps, not freeing them correctly, or a possible memory leak inside Dynamic?

Thanks
__________________
SM Plugins - dubbeh.net - Plugin requests are welcome
dubbeh is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 11-17-2016 , 20:34   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #157

Dynamic itself has no leaks.

I would say the plugin using Dynamic isn't disposing all its objects properly causing a leak over time.

If you can link source code im happy to have a squiz.
__________________
Neuro Toxin is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 11-18-2016 , 01:47   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #158

Quote:
Originally Posted by Neuro Toxin View Post
If you can link source code im happy to have a squiz.
This is the plugin in question: https://forums.alliedmods.net/showthread.php?t=58850
__________________
sneaK is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 11-18-2016 , 01:57   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #159

Just having a quick look while at work in the main .sp so far.

Not really sure on how the plugin works.

However:

Code:
void MapCleanup()
{
	if (g_mRadioBaseMenu) { delete g_mRadioBaseMenu; g_mRadioBaseMenu = null; }
	if (g_mRadioBaseGenresMenu) { delete g_mRadioBaseGenresMenu; g_mRadioBaseGenresMenu = null; }
	if (g_mRadioCustomBaseGenresMenu) { delete g_mRadioCustomBaseGenresMenu; g_mRadioCustomBaseGenresMenu = null; }
	if (g_mRadioStationsMenu) { delete g_mRadioStationsMenu; g_mRadioStationsMenu = null; }
	if (g_mRadioCustomStationsMenu) { delete g_mRadioCustomStationsMenu; g_mRadioCustomStationsMenu = null; }
	if (g_mRadioVolumeMenu) { delete g_mRadioVolumeMenu; g_mRadioVolumeMenu = null; }
	
	if (g_bPlayListFound) {
		g_Genres.Dispose(true);
		g_Stations.Dispose(true);
		if (g_bShoutCastCustom && g_iRadioPlayType == RADIO_PLAY_TYPE_SHOUTCAST) {
			g_CustGenres.Dispose(true);
			g_CustStations.Dispose(true);
		}
	}
}
Is possibly better like this:

Code:
void MapCleanup()
{
	if (g_mRadioBaseMenu) { delete g_mRadioBaseMenu; g_mRadioBaseMenu = null; }
	if (g_mRadioBaseGenresMenu) { delete g_mRadioBaseGenresMenu; g_mRadioBaseGenresMenu = null; }
	if (g_mRadioCustomBaseGenresMenu) { delete g_mRadioCustomBaseGenresMenu; g_mRadioCustomBaseGenresMenu = null; }
	if (g_mRadioStationsMenu) { delete g_mRadioStationsMenu; g_mRadioStationsMenu = null; }
	if (g_mRadioCustomStationsMenu) { delete g_mRadioCustomStationsMenu; g_mRadioCustomStationsMenu = null; }
	if (g_mRadioVolumeMenu) { delete g_mRadioVolumeMenu; g_mRadioVolumeMenu = null; }
	
	if (g_Genres.IsValid)
		g_Genres.Dispose(true);

	if (g_Stations.IsValid)
		g_Stations.Dispose(true);

	if (g_CustGenres.IsValid)
		g_CustGenres.Dispose(true);

	if (g_CustStations.Dispose.IsValid)
		g_CustStations.Dispose(true);
}
.IsValid will return false if already disposed or not initialised.

Also note: Where you also initialise your Dynamic objects. Add a check for IsValid and if already valid, print a debug message as these would become leaks if not disposed before initialised.

I'll have a better look over the other source files on the weekend unless you advise of some leaks being found and fixed!
__________________
Neuro Toxin is offline
dubbeh
Senior Member
Join Date: Jul 2007
Old 11-18-2016 , 07:01   Re: Dynamic Objects and Properties - v.0.0.16 - [2016.07.14]
Reply With Quote #160

Main initialization is done inside radio.sp and radio/file.inc, everything else is reading from the method maps outside them 2 files.

Going to also run over all the code tonight and tomorrow, see if anything is incorrectly done. Add the couple of changes you recommended.

Thanks Neuro Toxin and blackhawk for helping with this.

Edit: I can't actually check IsValid on a Collection. Was thinking if using something along the lines of:

Code:
if (Collection.Count > 0)
  LogMessage("Memory leak detected. Dispose on g_Collection failed.");
Would be a viable alternative?

Cheers

Edit 2: Think i might have found a possible solution but would love some feedback.

Was looking over Dynamics sourcecode and noticed you have Collection.Clear to call Dispose over each member within a Collection.

Instead of doing:
Code:
Collection.Dispose(true);
Think i need to change it to:
Code:
// This appears to cycle over each member of the collection and call Dispose, instead of calling Dispose directly on the collection.
Collection.Clear(true);
Then possibly initialize the Collections at plugin start and only call Clear on each map end.

Would need to dig further into the sourcecode to understand how this works exactly. Going to look into this more tomorrow, It's almost 1am here.

Cheers
__________________
SM Plugins - dubbeh.net - Plugin requests are welcome

Last edited by dubbeh; 11-18-2016 at 17:52.
dubbeh is offline
Reply


Thread Tools
Display Modes

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 07:20.


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