debugging - Memory leak with Delphi/DBExpress -
i've weird problem application, memory usage goes few hundred megabytes @ once every , , application freezes. application written delphi, uses database, com (for opc) , tcp/ip.
with fastmm i've got following screen shot of memory usage. i'm not sure how read table, looks has allocated 296463552 bytes (0x100fb000, "magic number"?) 3 times.
any ideas? there way track non-delphi-mm memory allocations?
i'm using delphi 2007 fastmm 4.96.
edit:
i wrote small helper class using imallocspy track com memory allocations. here's excerpt got:
00119023 5:52:27.484 [4496] tcomallocspy.prerealloc size: 269462304 00119024 5:52:27.734 [4496] (0002760c){ntdll.dll } [7c82860c] kifastsystemcallret + $0 00119025 5:52:27.734 [4496] (0009f83a){myapp.exe} [004a083a] jcldebug.jclcreatethreadstacktrace (line 3943, "jcldebug.pas" + 7) + $1e 00119026 5:52:27.734 [4496] (003d496a){myapp.exe} [007d596a] comleakhelper.tcomallocspy.debugstack (line 46, "comleakhelper.pas" + 2) + $9 00119027 5:52:27.734 [4496] (003d4b52){myapp.exe} [007d5b52] comleakhelper.tcomallocspy.prerealloc (line 125, "comleakhelper.pas" + 4) + $2 00119028 5:52:27.734 [4496] (000053b6){myapp.exe} [004063b6] system.@wstrasg (line 14090, "sys\system.pas" + 10) + $0 00119029 5:52:27.734 [4496] (002e4490){myapp.exe} [006e5490] dbxcommon.tdbxcommand.settext (line 5304, "..\..\..\..\..\src\pas\dbx\driver\dbxcommon.pas" + 13) + $5 00119030 5:52:27.734 [4496] (0010a340){myapp.exe} [0050b340] widestrings.twidestrings.getvalue (line 580, "common\widestrings.pas" + 3) + $d 00119031 5:52:27.734 [4496] (002e1afc){myapp.exe} [006e2afc] dbxcommon.tdbxproperties.getvalue (line 4046, "..\..\..\..\..\src\pas\dbx\driver\dbxcommon.pas" + 1) + $7 00119032 5:52:27.734 [4496] (002e3fc9){myapp.exe} [006e4fc9] dbxcommon.tdbxconnectionex.getproductname (line 5071, "..\..\..\..\..\src\pas\dbx\driver\dbxcommon.pas" + 1) + $e 00119033 5:52:27.734 [4496] (003765fa){myapp.exe} [007775fa] sqlexpr.tsqlconnection.doconnect (line 2467, "..\..\..\..\..\src\pas\dbx\vcl\sqlexpr.pas" + 66) + $21 00119034 5:52:27.734 [4496] (0011876d){myapp.exe} [0051976d] db.tcustomconnection.setconnected (line 2628, "db.pas" + 8) + $4 00119035 5:52:27.734 [4496] (00118728){myapp.exe} [00519728] db.tcustomconnection.open (line 2611, "db.pas" + 0) + $4 00119036 5:52:27.734 [4496] (00375d6f){myapp.exe} [00776d6f] sqlexpr.tsqlconnection.checkconnection (line 2302, "..\..\..\..\..\src\pas\dbx\vcl\sqlexpr.pas" + 4) + $2 00119037 5:52:27.734 [4496] (00379241){myapp.exe} [0077a241] sqlexpr.tcustomsqldataset.checkconnection (line 3955, "..\..\..\..\..\src\pas\dbx\vcl\sqlexpr.pas" + 2) + $2 00119038 5:52:27.734 [4496] (0037968a){myapp.exe} [0077a68a] sqlexpr.tcustomsqldataset.opencursor (line 4045, "..\..\..\..\..\src\pas\dbx\vcl\sqlexpr.pas" + 3) + $4 00119039 5:52:27.734 [4496] (00125ea9){myapp.exe} [00526ea9] db.tdataset.setactive (line 9245, "db.pas" + 12) + $7 00119040 5:52:27.734 [4496] (00125ca1){myapp.exe} [00526ca1] db.tdataset.open (line 9201, "db.pas" + 1) + $6 ...
so, problem seems in database connection. i'm using firebird 2.1, dbexpress , interxpress firebird drivers upscene.
edit2: seems analyze similar problem, @ least focus on same lines here: http://www.yac.com.pl/mt.texts.sqlexpr-2.en.html
the problem bug in delphi 2007 dbexpress surface in multithreaded environment (it's not thread safe, after all). more information here: http://www.yac.com.pl/mt.texts.sqlexpr-2.en.html
Comments
Post a Comment