Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - toitus

Pages: [1]
1
General / Re: SFML and Memory Management
« on: July 13, 2014, 05:25:05 am »
Alright, this makes sense. I will do some research on RAII and smart pointers and continue
testing.

I appreciate the suggestions and thanks for the help.

2
General / Re: SFML and Memory Management
« on: July 13, 2014, 05:06:41 am »
Well, I know for sure that the problem is that I'm allocating and not cleaning properly.

I read that, in SFML, resources are freed when they go out of scope and that there are
no functions I can call to free resources for me. So, is this the reason I should be using RAII
and smart pointers (other than the fact that it's good c++ practice)? If so, I'll do a bit more research on the subject and adjust accordingly.
 

3
General / Re: SFML and Memory Management
« on: July 13, 2014, 04:39:39 am »
Edit: Sorry about the lack of specificity here, looking back I realize it's really hard to help
someone if they aren't specific about their issues.

To be a little more specific, I'm experimenting with state management.
At the moment, I'm using a stack (std::vector) of state pointers.

So, I push state objects created with the new keyword when I want to change state
and then I attempt to delete the previous state pointer and remove it from the stack.

I'm not using smart pointers.

I've tested this same method in SDL but SDL's clean up functions are very clear which makes it
easy to clean up.

I'm only testing with two states. One state has a RenderTexture and a couple Textures, the other has no Textures at all.

What happens is when I repeatedly switch between states, memory usage increases by ~2mb per switch.

I guess I'm mostly curious how to handle clean up in SFML2.

Edit: I really like clean up in SDL, it's very straight forward, but SFML offers a lot of nice features and I think I would prefer it over SDL if I can figure out how to manage my resources correctly.

Thanks for the response also =P
I'm reading your RAII link right now, that may fix my issues.

4
General / SFML and Memory Management
« on: July 13, 2014, 04:13:19 am »
I'm curious how people are handling memory management in SFML2.

Right now, I have no idea how memory of sf::Font, Texture, etc, are handled, or supposed to be
handled, in SFML2.

If anyone has any good resources for learning on this subject, please let me know.

Pages: [1]
anything