Xojo.Core.Date Memory leak FB Case #59888

Hello Everyone,

I have made a test Desktop project on Xojo 2019r3.1 for Windows, that has a Basic Window1 that runs when app runs.
On the App open event I have the code below:

[i]db = new SQLDatabaseMBS
db.Option(“OLEDBProvider”) = “SQLNCLI10” // SQLNCLI for SQL Server 2005, SQLNCLI10 for newer version.
db.DatabaseName = “SQLServer:(local)\sqlexpress@testdb”
db.UserName = “sa”
db.Password = “1234”
db.Option(“UseAPI”) = “OLEDB”
db.AutoCommit = SQLDatabaseMBS.kAutoCommitOn
If db.Connect() Then

MsgBox “??? ??? ?? ??? ??? ?? ??? database!”
End If[/i]

This Window has a Timer Class which in its action event runs the code below

[i]dim s as String

Dim rs as RowSet = app.db.SelectSQL(“select * from E_P_PARAMETERS”)

while not(rs.AfterLastRow)

Dim c as new cTestClass
c.timestamp = rs.Column(“epar_timestamp”).DateValue

cTestClass has only one property called Timestamp which is type Date

I am using XojoInstruments and every time my window’s timer runs, instruments show me that Xojo.Core.Date increases by one.
It seems there is a memory leak there. I have seen an oldest conversation about xojo.core.Date and a memory leak in Xojo 2015.
Do I have something wrong in my code?
I have used DatetimeValue on RowSet too and I have the same results.

Thank you in advance.

What is the type of cTestClass.TimeStamp? Is it Xojo.Core.Date or Date or DateTime?

Xojo recommends DateTime, which is the latest class that Xojo introduced to use for DateTime values for now and in the future.

Change the TimeStamp to a DateTime, then change this line to:

c.timestamp = rs.Column("epar_timestamp").DateTimeValue

However, I don’t know if this will solve the memory leak.

Hey Brandon,

First of all thank you for your reply.
I have already tested it with datetime and I have the same results.
Here is the compare in Instruments where you can see that Datetime and Xojo.Core.Date have been increased after timer had run.


Thank you Alberto for the image.

Bug needing a report in the feedback app ASAP. :stuck_out_tongue:

What is this image evidence of? I see nothing in it about memory.

Hey Tim,

Memory is Increasing too. I did not post Memory Logs because I wanted to check if I am doing anything wrong.
As you can see in the Image the counter of the Xojo.Core.Date and Datetime increases every time I assign the result of a Rowset to a propery inside a Timer.

Have anything to suggest on the above example or explain to me why Counter of this specific object keep increasing inside the local action of a window timer?

This is what I am looking in this conversation.

Rick, I have found a similar feedback case 41153 which was fixed and I am waiting for someone from Xojo to explain me if I am doing something wrong on the example I described above.

Thank you both for your replies.

If you can write a simple example of your case, and share here. Not only Xojo, but we, users, can emit a better opinion about the intent.

Dear @Rick Araujo ,

As I wrote above,

I have a Test Project which connect to SQL Database.
I have a simple window which has a Timer Class on it.
This Timer runs every some seconds and runs a simple query Select * FROM TABLE.
When I parse the Rowset of the Query which has a Xojo.Core.Date, I capture my project Instance with Instruments and the Counter of the Xojo.Core.Date increases despite the fact that this class is Instatiated inside the Timer Locally.
I believe that the Xojo.core.Date should have been increased but also decreased at the same time.
Of course this is my opinion. And I am willing to hear someone else’s to see if I am wrong or not.

I came to this problem because the real Application I have developed, is running a Timer and after some hours of continuous working, my project’s Memory use is increased and instruments show me Just the increase of Xojo.Core.Date.

I cannot understand why the Xojo.Core.Date counter increases and not be released when the action method of Timer ends.

Thank you again for your interest.

You are correct. Just watching without running it, we see that inside a loop, you create a new object from a custom class, set a property of such class to a new datetime and start over. Each loop must have an implicit scope starting and releasing its local resources at the end. That’s probably bugged. THAT’S A SERIOUS BUG IF CONFIRMED. See if this solves, let’s emulate the implicit scope explicitly:

while not(rs.AfterLastRow) if true then Dim c as new cTestClass c.timestamp = rs.Column("epar_timestamp").DateValue rs.MoveToNextRow() end wend


Thank you very much.
I have tried everything but Xojo.Core.Date count still increasing without being released.
It seems that there is a bug. The problem with that is that I have found the case 41153 which is similar to my case
and they say that this bug is fixed & verified.
I am writing a feedback case right now as no one from Xojo seems to be interested in this memory situation.

Thank you again and sorry for my late answer but we have Easter in Greece.

The bug <https://xojo.com/issue/41153> was a case of 2015 fixed in 2016. Your case seems a new one.

Rarely they pay attention to the forum without a FB case. Once you confirm a bug, write a sample, and post the bug report there and case number here, for other users to follow.


I have submitted <https://xojo.com/issue/59888>
You are right Rick. On Xojo 2016r3 the same Test App I have created, has no memory leak with Date.
The counter remains the same after every run.

Thank you again for your help and interest.