Memory leak MSSQL in DLL

Hi,
I have been asked to look at one project.
Clarion 11 13505 MSSQL. There is a memory leak if I enter and exit more times a browse, but only if there is a particular file under other files listed. If I put another file it seems ok. Very fast after 2, 3 openings the app crashes. The project is multidll. The problem goes away if I remove the thread attribute from that particular file or if I use the single app version instead of multidll or if I start the browse in the main thread. Using MARS and busyhandling=2. Tried to change almost every field in table. I am not big clarion/mssql expert, so maybe I miss something obvious. I tried also to delete file in dictionary and to import from sql as it is, the result is the same.
Thanks

Hi Nen, welcome to ClarionHub.

Have you tried other versions of Clarion 11?
Can you post the Clarion table definition and the create script for the SQL table?

I suggest trying v13401. It has been solid for me with PostgreSQL.

v13505 brought some driver changes that could come into play and v13622 additional issues that seem similar to what you describe.

Unfortunatelly I am acting as consultant on this one, so do not have access to all clarion versions. This is the clarion definition from my data dll

TrackItems           FILE,DRIVER('MSSQL'),PRE(TRI),CREATE,BINDABLE,THREAD,EXTERNAL('') ! Items to be Tracked 
ITMResponsibleGroupKey   KEY(TRI:ResponsibleGroup),DUP,NOCASE,OPT !                     
ItemIDKey                KEY(TRI:ItemID),NOCASE,OPT,PRIMARY !                     
ITMGroupKey              KEY(TRI:LGroup),DUP,NOCASE,OPT    !                     
ITMItemKey               KEY(TRI:Item),DUP,NOCASE,OPT      !                     
ITMInputKey              KEY(TRI:InputMethod,TRI:Item),DUP,NOCASE,OPT !                     
ITMBarKey                KEY(TRI:BarCode),DUP,NOCASE,OPT   !                     
ITMCatKey                KEY(TRI:Category,TRI:Item),DUP,NOCASE,OPT !                     
ITMMonitorKey            KEY(TRI:Monitor,TRI:ItemID),DUP,NOCASE !                     
Record                   RECORD,PRE()
Item                        CSTRING(41)                    !                     
Device                      CSTRING(31)                    !                     
DeviceType                  CSTRING(21)                    !                     
InputMethod                 CSTRING(21)                    !                     
Frequency                   CSTRING(21)                    !                     
LGroup                      CSTRING(21)                    !                     
ItemID                      LONG                           !                     
InputForm                   CSTRING(21)                    !                     
Equipment                   CSTRING(41)                    !                     
LastTime                    LONG                           !                     
LastDate                    LONG                           !                     
FreqAmount                  LONG                           !                     
FreqDay                     CSTRING(11)                    !                     
FreqDayTime                 LONG                           !                     
DetailName                  CSTRING(51)                    !                     
Monitor                     CSTRING(2)                     !                     
LStandard                   BYTE                           !                     
OverRideFlag                BYTE                           !                     
CCP                         BYTE                           !                     
LastHlnSysID                LONG                           !                     
BarCode                     CSTRING(41)                    !                     
LastNotDone                 LONG                           !                     
Category                    CSTRING(21)                    !                     
PrimsStartDate              LONG                           !                     
VerifyBy                    CSTRING(21)                    !                     
Verify                      BYTE                           !                     
ResponsibleGroup            CSTRING(21)                    !                     
AutoByPass                  BYTE                           !                     
PutsEquipmentInTestMode     BYTE                           !                     
DocLink                     CSTRING(251)                   !                     
ImageByButton               CSTRING(2)                     !                     
LinkItemID                  LONG                           !                     
UseSchedule                 CSTRING(2)                     !                     
IgnoreAmount                REAL                           !                     
PurgeDays                   LONG                           !                     
Instructions                CSTRING(1001)                  !                     
AlarmCondition              CSTRING(2)                     !                     
SQFStandard                 CSTRING(61)                    !                     
SQFVersion                  CSTRING(61)                    !                     
DocID                       LONG                           !                     
AutoTask                    CSTRING(2)                     !                     
LogDataChangesOnly          CSTRING(2)                     !                     
PostToPrims                 CSTRING(2)                     !                     
CurHlnSysID                 LONG                           !                     
DataLogTemp                 REAL                           !                     
CurLogRecID                 LONG                           !                     
CoolDwonFlag                CSTRING(2)                     !                     
                         END
                     END        

the table is defined in the separate module inside the data dll.
And this is the sql definition

CREATE TABLE [dbo].[TrackItems](
	[ITEM] [varchar](40) NULL,
	[DEVICE] [varchar](30) NULL,
	[DEVICETYPE] [varchar](20) NULL,
	[INPUTMETHOD] [varchar](20) NULL,
	[FREQUENCY] [varchar](20) NULL,
	[LGroup] [varchar](20) NULL,
	[ITEMID] [int] NOT NULL,
	[INPUTFORM] [varchar](20) NULL,
	[EQUIPMENT] [varchar](40) NULL,
	[LASTTIME] [int] NULL,
	[LASTDATE] [int] NULL,
	[FREQAMOUNT] [int] NULL,
	[FREQDAY] [char](10) NULL,
	[FREQDAYTIME] [int] NULL,
	[DETAILNAME] [varchar](50) NULL,
	[MONITOR] [varchar](1) NULL,
	[LStandard] [tinyint] NULL,
	[OVERRIDEFLAG] [tinyint] NULL,
	[CCP] [tinyint] NULL,
	[LASTHLNSYSID] [int] NULL,
	[BARCODE] [varchar](40) NULL,
	[LASTNOTDONE] [int] NULL,
	[CATEGORY] [varchar](20) NULL,
	[PRIMSSTARTDATE] [int] NULL,
	[VERIFYBY] [varchar](20) NULL,
	[VERIFY] [tinyint] NULL,
	[RESPONSIBLEGROUP] [varchar](20) NULL,
	[AUTOBYPASS] [tinyint] NULL,
	[PUTSEQUIPMENTINTESTMODE] [tinyint] NULL,
	[DOCLINK] [varchar](250) NULL,
	[IMAGEBYBUTTON] [varchar](1) NULL,
	[LINKITEMID] [int] NULL,
	[USESCHEDULE] [varchar](1) NULL,
	[IGNOREAMOUNT] [float] NULL,
	[PURGEDAYS] [int] NULL,
	[INSTRUCTIONS] [varchar](1000) NULL,
	[ALARMCONDITION] [varchar](1) NULL,
	[SQFSTANDARD] [varchar](60) NULL,
	[SQFVERSION] [varchar](60) NULL,
	[DOCID] [int] NULL,
	[AUTOTASK] [varchar](1) NULL,
	[LOGDATACHANGESONLY] [varchar](1) NULL,
	[POSTTOPRIMS] [varchar](1) NULL,
	[CURHLNSYSID] [int] NULL,
	[DATALOGTEMP] [float] NULL,
	[CURLOGRECID] [int] NULL,
	[COOLDWONFLAG] [varchar](1) NULL,
 CONSTRAINT [ITEMIDKEY] PRIMARY KEY CLUSTERED 
(
	[ITEMID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ITMBARKEY] ON [dbo].[TrackItems]
(
	[BARCODE] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ITMCATKEY] ON [dbo].[TrackItems]
(
	[CATEGORY] ASC,
	[ITEM] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ITMGROUPKEY] ON [dbo].[TrackItems]
(
	[LGroup] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ITMINPUTKEY] ON [dbo].[TrackItems]
(
	[INPUTMETHOD] ASC,
	[ITEM] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ITMITEMKEY] ON [dbo].[TrackItems]
(
	[ITEM] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ITMMONITORKEY] ON [dbo].[TrackItems]
(
	[MONITOR] ASC,
	[ITEMID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ITMRESPONSIBLEGROUPKEY] ON [dbo].[TrackItems]
(
	[RESPONSIBLEGROUP] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
GO

Thanks

Ok, thanks I will look to try 13401

Does this also happen with a plain wizarded browse?
Wondering if some odd embed code might be affecting things.

1 Like

With template generated browse it is the same.

I tried with 13401, substituted all Cla dlls, but without recompiling, it should suffice I think, and on template generated browse. Same thing.

The only thing that jumps out as odd to me is your SQL definition is not specifying a size for the varchar columns. This means you’ll get the default length of 30. A number of your column definitions in the Clarion table are larger than this. Any chance you can recreate the SQL table with explicit column lengths for the varchar columns?

Sorry, but I do not understand.
I see each of sql varchar column has the size set
Is there another sql syntax I am not aware of?

That is so bizarre. When I copied the create table statement originally, I got no size values for any of the varchar fields.
Sorry about that.

np, thanks for finding time to read the post
I have to abandon this problem for now but I have to solve it

I have finally found. The leak is caused by Secwin. I do not even know what is this option for. I will pass info to my client and just leave a note here in case someone experience the same problem.

Note that I had to remove the option from data dll, but also from exe dll, but there it was not visible. Thats because the multidll check was on. I had to uncheck multidll option, delete the TrackItems row and check again the multidll. The code was generated even if the template did not show it. This happened because the project was initially one app and when was split to dll the setting stayed hidden. Anyway it is an error that the code is generated.

1 Like

Secwin 6 not Secwin 7 right?

1 Like