Raised This Month: $32 Target: $400
 8% 

Deallocating Resources


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 07-07-2011 , 07:38   Deallocating Resources
Reply With Quote #1

I've always wondered, but never asked. In some plugins, scripters who use forwards, arrays, and such, choose to destroy them at plugin_end. I also see some people who do not. I was wondering what would be the effects of not deallocating the memory? Does amxmodx do anything about this on plugin_end?
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 07-08-2011 , 04:00   Re: Deallocating Resources
Reply With Quote #2

I just wanted to add that, what I mean, is like how harmful is it not to destroy these varaibles/etc.
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
BAILOPAN
Join Date: Jan 2004
Old 07-08-2011 , 14:04   Re: Deallocating Resources
Reply With Quote #3

Plugins and everything they've allocated are freed when the plugin is unloaded. Plugins are unloaded on mapchange. All of this happens regardless of what's in plugin_end.
__________________
egg
BAILOPAN is offline
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 07-08-2011 , 14:25   Re: Deallocating Resources
Reply With Quote #4

http://en.wikipedia.org/wiki/Garbage...ter_science%29
I don't know if pawn has it, but from here you can learn something relevant to your question.
__________________
ehha is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-08-2011 , 23:46   Re: Deallocating Resources
Reply With Quote #5

Quote:
Originally Posted by BAILOPAN View Post
Plugins and everything they've allocated are freed when the plugin is unloaded. Plugins are unloaded on mapchange. All of this happens regardless of what's in plugin_end.
Somebody had to submit a patch for a file pointer being left open that didn't get closed. Does this not prove that it doesn't completely clear the memory when the plugin is unloaded?
__________________
fysiks is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 07-09-2011 , 05:45   Re: Deallocating Resources
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
Somebody had to submit a patch for a file pointer being left open that didn't get closed. Does this not prove that it doesn't completely clear the memory when the plugin is unloaded?
I believe sockets are not closed too.
__________________
xPaw is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 07-09-2011 , 05:55   Re: Deallocating Resources
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
Somebody had to submit a patch for a file pointer being left open that didn't get closed. Does this not prove that it doesn't completely clear the memory when the plugin is unloaded?
I think he is talking about only of what happens inside plugins and not through module's natives calling. Like, if you call a native that allocates memory, it won't be freed unless the module manages it right. So, the answer to Tirant's question is that it depends on how the module manages it.
joaquimandrade 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 09:34.


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