Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Found Memory Leak in TIER1 when using CountStringTokens inside a function

Author
Message
Abiz
11
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 25th Jun 2017 04:26 Edited at: 25th Jun 2017 04:36
Here is the code: run it and open the TASK manager. Look at the memory usage going crazy.

Further testing reveals it is CountStringTokens all by itself


SetVirtualResolution ( 1200, 750 )
do
If GetRawKeyReleased( 27 ) = 1 then End

for x = 1 to 3000
num = CountStringTokens( "123^12^45^78^89^78^", "^" )
next x
Sync ()
loop
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 25th Jun 2017 09:20
Hi

it seems it's the same with GetStringToken()

AGK2 tier1 - http://www.dracaena-studio.com
Lucas Tiridath
AGK Developer
15
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 25th Jun 2017 09:24
Yep, seeing the same thing here. Interestingly CountStringTokens2 seems to be OK.
Abiz
11
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 26th Jun 2017 01:07
Actually, CountStringToken2 also has a memory leak, but stabilizes after 3 minutes of about 1MB growth, with this code

// set a virtual resolution
SetVirtualResolution ( 1200, 750 )

// main loop
do

If GetRawKeyReleased( 27 ) = 1 then End

for x = 1 to 3000
num = CountStringTokens2( "123|12|45|78|89|78|", "^" )
a$ = GetStringToken2( "123|12|45|78|89|78|", "^", 3 )
next x

// update the screen
Sync ()
loop
GameDevGuy
8
Years of Service
User Offline
Joined: 18th Jul 2015
Location:
Posted: 26th Jun 2017 06:01
Yikes, running the original code above, in less than a minute AppGameKit has worked it's way to the top of Windows Task Manager and is using more memory than my most memory intensive web browser tab.

Hope it is fixed soon.

Login to post a reply

Server time is: 2024-04-19 08:40:33
Your offset time is: 2024-04-19 08:40:33