Jump to content

2 quick questions about gdi+ usage in loops


Strydr
 Share

Recommended Posts

I would like to make sure that I'm understanding some basic usage and not creating memory problems (or any other type of problems)

Usage scenario would be to do a quick gdi+ operation and then loop again.  The specific operation shouldn't be important for this, as far as I know.

So, as I understand things, the usage would go somewhat like this:

Startup gdi+

go into loop

perform operations

return

once loop is completed, dispose/delete temp images used.

shutdown gdi+

 

The 2 specific things that I'd like to confirm are:

1)start gdi+ before loop and close it after loop, as opposed to starting and stopping it in each loop session.

2)delete and dispose of temp images used in operations AFTER loop is exited.  The theory being that the memory used is overwritten each loop, as opposed to written sequentially, which could eat a lot of memory. 

 

Thank you for your help!

ps: I'm really good at NOT including the basics that you need to answer my questions:  sorry if I missed something again.

Link to comment
Share on other sites

Yes to question 1 no doubt

Maybe to question 2 depending of the code you are using, if for example you read different part of the screen, or load different images, etc, you may need to dispose at each action...

Link to comment
Share on other sites

The image would be different (same location, tho) each loop, with the possibility of different sizes.  Interesting!  Sounds as if it would be safer to clean up.

Any idea if there are there any appreciable performance hits or other issues by cleaning up after each loop?  (I would imagine that this is a stupid question, but I have to ask)

Link to comment
Share on other sites

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...