Hi Alaska-team.
 
Our big xBase++ multithread application uses ADS-connect. Sometimes it runs a long SQL-query (f.e. "EXECUTE PROCEDURE sp_CreateBackup()").
When we run such query in the main thread all works properly but when we run it in another one we can see a VERY BIG MEMORY LEAK and after 1hour application uses 220 Mb memory and crashed.
 
Just now I recreate this issue on your mdidemo
 
with very simple source code:
 
////////////////////// ADS THREAD ///////////////////////////////////////////////////
FUNCTION ThreadAds()
LOCAL oDlg
LOCAL oThread, oThreadAds
// RunSql query
oThreadAds := Thread():new()
oThreadAds:start({|| LongSqlRun() })
// this code to send events to main window
FOR i:=1 TO 10000
    PostAppEvent(xbeP_Move,SetAppWindow():currentPos(),SetAppWindow():currentPos(),SetAppWindow())
    sleep(5)
NEXT
RETURN NIL
//==========================================
FUNCTION LongSqlRun()
LOCAL nConnect  := 0
LOCAL nStatment := 0
LOCAL hCursor   := 0
 
// sleep works properly
//sleep(48000)
 
DllCall( 'ace32.dll',32, "AdsConnect60", 'd:\UNIVERSAL\EXPO\Globino\7.12\UNIVERSAL-7.ADD', 2, 'AdsSys', 'air', 0, @nConnect)
DllCall( 'ace32.dll',32, "AdsCreateSQLStatement",   nConnect,  @nStatment    )
// some minutes with very big memory leak
DllCall( 'ace32.dll',32, "AdsExecuteSQLDirect", nStatment, "SELECT * INTO #trrrr FROM sodoper WHERE summa=3.14", @hCursor )
DllCall( 'ace32.dll',32, "AdsCloseTable", hCursor )
DllCall( 'ace32.dll',32, "AdsCloseSQLStatement", nStatment )
DllCall( 'ace32.dll',32, "AdsDisConnect", nConnect )
msgBox('Finish')
RETURN NIL
I can see a VERY BIG memory leak through windows TaskManager, but when I change long SQL-query to sleep() all work w/o leak.
I guess the problem happens because the main window gets events while SQL-query is running.
 
If I delete following code
FOR i:=1 TO 10000
    PostAppEvent(xbeP_Move,SetAppWindow():currentPos(),SetAppWindow():currentPos(),SetAppWindow())
    sleep(5)
NEXT
and just manually move the window of application by mouse I see the same memory leak.
Please help us to fix this problem.
 
P.S. I can send the database or separate table for a long query:)
 
 
 
 
 

----------
Best regards,
Igor Golobrodskiy
WG SoftPro
E-mail:
igor@wgsoftpro.com
URL:http://www.wgsoftpro.com