Raised This Month: $ Target: $400
 0% 

plugin_end() & SQL_FreeHandle = WRONG


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
waza123a
Member
Join Date: Mar 2010
Old 03-13-2010 , 13:59   plugin_end() & SQL_FreeHandle = WRONG
Reply With Quote #1

If you use plugin_end() with SQL_* then you will get random crash on map change. (Linux 100% , possible in win too)


Some docs:

Quote:
Native Overview
The basic natives of SQLX are:
  • SQL_FreeHandle - Frees a Handle. You must do this or else memory will leak.
    • Note that you should currently not call this native during plugin_end(). The backend threader freezes the query queue at this time and flushes all remaining queries back to the main thread. It is likely your plugin will simply deadlock (freeze idly). Even if this is corrected, there is no reason to use threaded queries in plugin_end() anyway, because all remaining threaded queries are executed as non-threaded before the mapchanges.

So, then there is a question, where to put

SQL_FreeHandle ?

When plugin starts, it's connecting to mysql and connection is alive until map change, then you need some how close mysql connection or you will got memory leak, so how to do it ?

Thanks.
waza123a is offline
 



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 08:45.


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