I have played a bit with arrays.
This is the code.
// Project: memory-test
// Created: 2017-03-10
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "memory-test" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 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
Type huge
array0 As integer[1000]
array1 As float[1000]
array2 As String[1000]
EndType
myarray as huge[]
Print("Begin.")
Sync()
sleep(10000)
for i=0 to 3000
v as huge
For j = 0 To 1000
v.array0[j] = Random()
v.array1[j] = Random() / 13.0
For s = 0 To 16
ch = ASC("A") + Mod(Random(), 26)
v.array2[j] = v.array2[j] + Chr(ch)
Next
Next
myarray.insert(v)
memcon$ = "Theoretical memory consumption.: "+Str(i * (1000*4+1000*4+1000*16))
Print(i)
Print(memcon$)
Sync()
Next
Print("Ready.")
Sync()
sleep(5000)
Print("Clear")
Sync()
myarray.length = -1
sleep(5000)
do
Print( ScreenFPS() )
Sync()
loop
And my results.
Memory usage before generating and filling the array.
44,444 B
Memory usage at its highest.
1,252,512 B
Memory usage after deleting the array
61,040 B
This is a difference of 16,596 bytes between filling the array and deleting the array.
I don't know what is not released there. I have run the test without the string. There was a difference of 4,396 bytes.