Quote: "I wonder if it makes any difference if you let AppGameKit assign the IDs and return them to you instead of specifying the IDs at creation?"
Here's a new test. This one is interesting. Everything performed almost identical to the first test up to the 3 minute mark. At 3 minutes, there was a sudden shift from 30.2MB to 25.1MB. However, it stayed at 25.1MB for the rest of the test. Conditions were the same, 5min+ and counts over 30,000,000.
// Project: MemLeakTest
// Created: 2018-08-16
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "MemLeakTest" )
SetWindowSize( 720, 405, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 720, 405 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 0, 1 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
SetPrintColor( 255, 255, 0 )
global spriteCount as integer
global textCount as integer
global spriteIDs as integer[1000]
global textIDs as integer[1000]
global numOf as integer = 1000
do
if GetRawKeyPressed( 32 ) then exit
Print( "Press space to start." )
sync()
loop
do
for i = 1 to numOf
if GetSpriteExists( spriteIDs[i] ) then DeleteSprite( spriteIDs[i] )
if GetTextExists( textIDs[i] ) then DeleteText( textIDs[i] )
next
for i = 1 to numOf
spriteIDs[i] = CreateSprite( 0 )
SetSpriteSize( spriteIDs[i], Random( 25, 100 ), Random( 25, 100 ) )
SetSpritePositionByOffset( spriteIDs[i], Random( 0, 720 ), Random( 0, 405 ) )
SetSpriteColor( spriteIDs[i], Random( 0, 255 ), Random( 0, 255 ), Random( 0, 255 ), 90 )
textIDs[i] = CreateText( chr( Random( 33, 126 ) ) )
SetTextSize( textIDs[i], Random( 10, 26 ) )
SetTextPosition( textIDs[i], Random( 0, 720 ), Random( 0, 405 ) )
SetTextAlignment( textIDs[i], Random( 0, 2 ) )
SetTextColor( textIDs[i], Random( 0, 255 ), Random( 0, 255 ), Random( 0, 255 ), 90 )
inc spriteCount
inc textCount
next
PrintC( "FPS: " ) : Print( Str( ScreenFPS(), 0 ) )
PrintC( "spriteCount: " ) : Print( spriteCount )
PrintC( "textCount: " ) : Print( textCount )
Sync()
loop