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 / [SOLVED] DeleteImage() Very Slow

Author
Message
Nieb
9
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 24th Apr 2018 10:37 Edited at: 24th Apr 2018 10:42
I'm running into some odd slow down with the DeleteImage() function.

The first run through of the function is quick. On the second run through, and after, it is very slow.
If you comment out the DeleteImage() function it works quick every time. However, the vRAM usage grows.

Am I doing something bad with my code?


Attachments

Login to view attachments

The author of this post has marked a post as an answer.

Go to answer

Nieb
9
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 24th Apr 2018 11:58
I think I figured out the issue, the function isn't updating the reference var with the ImageID...
TomToad
6
Years of Service
User Offline
Joined: 6th Jan 2018
Location:
Posted: 24th Apr 2018 12:20
This post has been marked by the post author as the answer.
You have a scope problem in the RenderbitmapArray function. ImageID is local to the function. When you first call the function, TheImage is copied into ImageID, which gets deleted as you expect. A new image is created and its ID stored in ImageID, but since ImageID is local to the function, the ID is lost when you exit. The next time through, TheImage is copied into ImageID again, but this is the old ID, not the one created in the last loop. If you pass ImageID back from the function, it will work. Or, since TheImage is declared Global anyway, you could just use that instead.

Login to post a reply

Server time is: 2024-04-20 00:54:07
Your offset time is: 2024-04-20 00:54:07