runtime.objectCount runaway in 64-bit

I have an application created that transmits data going to/from an sslSocket.

For testing, each time I obtain a packet from the remote end, I have it display the runtime.objectCount before the packet content (to make sure memory isn’t being used and objects are being destructed between each incoming packet).

Sure enough, in 64-bit builds runtime.objectCount starts increasing dramatically; however, the same application built in 32-bit it stays steady (although the runtime.memoryUsed starts to creep up; however, that’s for another time to figure out).

What approach can I use to figure out what it is that is not being properly destroyed and lingering around between events?

So I put a delay between transmits, which allowed any garbage collection, etc. to finish its process. This eventually got the runtime.objectCount to increase by 1 with each transmit. I then created a xojo.core.dictionary and referenced the runtime.objects between each call. What I found was this runtime.objectClass not ever getting destructed in the 64-bit application (adding another one with each transmit to the total application objects):

xojo.Data.InvalidJSONException

I use a method that uses try/catch exception handling when dealing with json to see whether it’s valid before decipher it. This is why this exception occurs; but I handle it programmatically (in case you are wondering why this is occurring with each event); however, this has nothing to do with it lingering like that.

create a new console application:

[code]
Function Run(args() as String) As Integer

dim loopIndex as int32

for loopIndex = 1 to 1000
if test(“blahblah”) then
end if

stdOut.writeLine(runtime.objectCount.toText)

next loopIndex

do
app.doEvents()
loop

End Function

Function test(jsonContent as text) As boolean

dim jsonDictionary as new xojo.core.dictionary

try ’ attempt to process the following code

jsonDictionary = xojo.data.parseJson(jsonContent)

return true

catch unhandledException ’ an unexpected exception has occurred while processing the above code

return false

end try

End Function[/code]

Build one for 32-bit, then one for 64-bit. You can see the runtime.objectCount add with each call in the 64-bit build, but stay constant in the 32-bit build. Could somebody please verify this? (Using Windows 10) Interested in seeing if this happens on other platforms.

did you report a Feedback case?

I haven’t yet. I like to get confirmation first (that it isn’t my own coding errs) before I put in a feedback case. 9 out of 10 times, things I thought were bugs ended up being something I did. I suggested a forums section for bug confirmations before submitting. I hate to populate the already populated feedback system with issues that aren’t really bugs, but the general forums aren’t really the place either…

EDIT: Let me put it another way. There’s a lot more of us than there are xojo developers. It’d be easier for us to confirm one another’s issues before submitting it there and taking up even more of their time. I know there will be those that say, “It’s not our job to do that and they get paid for it.”; however, I’d personally rather them spend their time fixing issues than confirming them (which again, we can do).

Okay, i can confirm it.

Feedback case 41881.

Thanks… I tried, but got an error and feedback crashed. It always happens to me. Not sure why it won’t run on my system properly.

It isn’t just a json exception that is causing this…

Change the function to the following and it still does it:

[code] dim a as new xojo.core.mutableMemoryBlock(44)
dim b as int32
dim c as text

for b = 0 to 43
a.uInt8Value(b) = xojo.math.randomInt(0, 255)
next b

try ’ attempt to process the following code

c = xojo.core.textEncoding.utf8.convertDataToText(a)

return true

catch unhandledException ’ an unexpected exception has occurred while processing the above code

return false

end try[/code]

So, it’s the exceptions in general causing the issue… not any specific one.

Maybe report this as another case?

They may be related or not.
When an exception is raised, the C++ developer needs to make sure all allocated objects are properly released.
e.g. Xojo may already allocated memory for the Text object and than discovered that it can’t convert the bytes.

and reported 41882

raising exceptions alone seems not to leak, so it may be related to specific functions.

Not so sure… everything I’m throwing at it so far is causing the same issue:

[code] dim a as new xojo.core.mutableMemoryBlock(99)

try ’ attempt to process the following code

a.uInt8Value(100000) = 2 ' cause an out-of-bounds

return true

catch 'unhandledException ’ an unexpected exception has occurred while processing the above code

return false

end try[/code]

EDIT: Perhaps just exceptions where objects have been constructed?