My program has several data modules, one containing ImageLists, that are created before the main form.
My program runs fine without Resource Leak enabled. But if I enable it, the following happens, sometimes:
* Run outside the IDE, the program hangs during initialisation. I don't see a main form, or any messages, and Madexcept does not show anything. So there is no obvious indication that the program is active at all. The only indication I get is that I can't recompile, because the compiler can't create a new EXE. However, Task Manager shows it under the "Background processes" category - not consuming CPU.
* When I run the program (no breakpoints) inside the IDE, I see an AV exception during startup. Click Continue and the program hangs as described above (nothing from Madexcept). See below for call stack examples if I click Break.
* Setting breakpoints in the .dpr file, the problem is happening during the creation of the first datamodule. I can change the order of datamodule creation, but it always seems to be the first one that causes the problem - that is, it is not related to anything specific in a particular datamodule.
* Now, the weird thing is that this behaviour is inconsistent. Sometimes, changing the order of creation of the various datamodules during startup does seem to clear the error for a while, and the problem seems to just go away - for a while. Sometimes, setting breakpoints and stepping through (either in the .dpr, or in the main form OnCreate) seems to be enough to avoid the AV and allow normal startup, but again this is not consistent.
* Call stack (from IDE) when failing to initialise a datamodule with just tables, queries and datasources:
Code: Select all
:6710305b ; C:\Program Files (x86)\madCollection\madExcept\Dlls\madExcept32.dll
:6cfe0013
System._GetMem(???)
System.TObject.NewInstance
System._ClassCreate(???,???)
Data.DB.{System.Generics.Collections}TList<Data.DB.TField>.Create
Data.DB.TFields.Create($9C0EA68)
:008a086a TFields.Create + $2A
:00b6c99e TABSDataSet.Create + $36
:00b6f6be TABSTable.Create + $36
System.Classes.CreateComponent
System.Classes.TReader.ReadComponent(nil)
System.Classes.TReader.ReadDataInner(???)
System.Classes.TReader.ReadData($B188920)
System.Classes.TComponent.ReadState(???)
System.Classes.TDataModule.ReadState(???)
System.Classes.TReader.ReadRootComponent($B188920)
System.Classes.TStream.ReadComponent($B188920)
System.Classes.InternalReadComponentRes(???,???,$B188920)
System.Classes.InitComponent(TKeyTables)
System.Classes.InitInheritedComponent($B188920,TDataModule)
System.Classes.TDataModule.Create(???)
Vcl.Forms.TApplication.CreateForm(???,(no value))
TopshareV3.TopshareV3
:74663744 KERNEL32.BaseThreadInitThunk + 0x24
:773c9cd4 ntdll.RtlSetCurrentTransaction + 0xd4
:773c9c9f ntdll.RtlSetCurrentTransaction + 0x9f
Code: Select all
:6710305b ; C:\Program Files (x86)\madCollection\madExcept\Dlls\madExcept32.dll
:671cc359 ; C:\Program Files (x86)\madCollection\madExcept\Dlls\madExcept32.dll
:671d42df ; C:\Program Files (x86)\madCollection\madExcept\Dlls\madExcept32.dll
Vcl.Graphics.TBitmap.ReadDIB($B1D1518,???,$19FAC0)
Vcl.Graphics.TBitmap.ReadStream($B1D1518,1078)
Vcl.Graphics.TBitmap.ReadData($B1D1518)
:0059de73 TBitmap.ReadStream + $67
System.Classes.TReader.DefineBinaryProperty(???,(cxGraphics.TcxBitmap.ReadData,$B1F85B0),(cxGraphics.TcxBitmap.WriteData,$B1F85B0),???)
Vcl.Graphics.TGraphic.DefineProperties($B1E1B48)
System.Classes.TReader.ReadProperty($B1EF8B0)
System.Classes.TReader.ReadCollection($B1DE928)
:007989fd TcxImageList.ReadImageInfo + $25
:007987da TcxImageList.DefineProperties + $CE
System.Classes.TReader.ReadProperty($B1D26A8)
System.Classes.TReader.ReadDataInner($B1D26A8)
System.Classes.TReader.ReadData($B1D26A8)
System.Classes.TComponent.ReadState(???)
System.Classes.TReader.ReadComponent(nil)
System.Classes.TReader.ReadDataInner(???)
System.Classes.TReader.ReadData($B0E8920)
System.Classes.TComponent.ReadState(???)
System.Classes.TDataModule.ReadState(???)
System.Classes.TReader.ReadRootComponent($B0E8920)
System.Classes.TStream.ReadComponent($B0E8920)
System.Classes.InternalReadComponentRes(???,???,$B0E8920)
System.Classes.InitComponent(TImageListsDM)
System.Classes.InitInheritedComponent($B0E8920,TDataModule)
System.Classes.TDataModule.Create(???)
Vcl.Forms.TApplication.CreateForm(???,(no value))
TopshareV3.TopshareV3
:74663744 KERNEL32.BaseThreadInitThunk + 0x24
:773c9cd4 ntdll.RtlSetCurrentTransaction + 0xd4
:773c9c9f ntdll.RtlSetCurrentTransaction + 0x9f
Thanks,
Chris.