- Eric Verhorstert
- PowerBuilder
- Friday, 6 October 2023 10:24 AM UTC
We converted a PB 12.5 application to PB 2022R2 2819.
I ran a procedure which makes intensive use of oleobject. In PB 12.5 the memory usage is stable at around 50Mb.
In PB 2022 the memory starts at 50Mb and increases to 1200Mb. The memory is released when we close the IDE.
Tried to reproduce it. Below the code that does not release the memory in PB2022 but works find in PB12.5.
long i
oleobject lole_json
oleobject lole_jsondataobj
oleobject lole_jsondataobj2
oleobject lole_jsondataobj3
for i = 1 to 10000
lole_json = create oleobject
lole_json.connecttonewobject("Chilkat_9_5_0.jsonobject")
lole_json.clear()
lole_json.AddObjectAt(-1, "header")
lole_jsondataobj = lole_Json.ObjectAt( lole_json.Size - 1)
lole_jsondataobj.AddStringAt(-1, "languageCode", 'eng')
lole_jsondataobj.AddStringAt(-1, "dateTimeIssueing", string(datetime(today()), 'yyyy-mm-ddThh:mm:ssZ'))
lole_json.AddObjectAt(-1, "introduction")
lole_jsondataobj = lole_Json.ObjectAt( lole_json.Size - 1)
// add array sow secondary reference id's
lole_jsondataobj.AddObjectAt(-1, "something")
lole_jsondataobj2 = lole_Jsondataobj.ObjectAt( lole_jsondataobj.Size - 1)
lole_jsondataobj2.AddObjectAt(-1, "line")
lole_jsondataobj3 = lole_Jsondataobj2.ObjectAt( lole_jsondataobj2.Size - 1)
lole_jsondataobj3.AddStringAt( -1, "id", string( i ))
lole_jsondataobj2.AddStringAt( -1, "dateTime", string(today(), 'yyyy-mm-ddThh:mm:ssZ'))
if isvalid( lole_jsondataobj3 ) then destroy (lole_jsondataobj3 )
if isvalid( lole_jsondataobj2 ) then destroy (lole_jsondataobj2 )
if isvalid( lole_jsondataobj ) then destroy (lole_jsondataobj )
if isvalid( lole_json ) then destroy (lole_json )
garbagecollect()
end for
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.