1
General / My SFML project uses large amounts of RAM and the font displays half of text
« on: February 20, 2015, 03:57:26 am »
Two problems, I'll start with the text not displaying correctly because that is the most obvious issue:
Only certain letters show. This was not always the case, I tweaked some graphics code in another part of the project and this started happening. In fact, I was trying to solve the second problem when the first problem started happening.
Secondly, the program uses massive amounts of ram. To replicate, fly the ship in one direction. The ram usage climbs upward and upward. After 7 hours it uses 700mb of ram.
I managed to comment code until I found the issue. It is located in source/Game/Misc/SpaceBackground.d at line 254.
I've attached the source and the executables.
Instructions to run the executables:
(1) Run the server executable.
(2) cd to the Game Executables directory.
(3) Run the Game executable.
(4) Type in letters for the username. Click Enter. Type in letters for the password. Click Enter. Type in letters for a name. Click Enter.
(5) Fly the space ship using the arrow keys. Watch the ram usage. Also notice the missing letters in the text.
Instructions for running from the source:
Use DUB.
Note: The source is using DSFML with the D Language.
I would appreciate ideas for why SFML is failing to render text and uses lots of memory for drawing circle shapes.
Source: http://cl.ly/2H3D3T3A0J2G
Executables: http://cl.ly/2L2v17471u3b
Only certain letters show. This was not always the case, I tweaked some graphics code in another part of the project and this started happening. In fact, I was trying to solve the second problem when the first problem started happening.
Secondly, the program uses massive amounts of ram. To replicate, fly the ship in one direction. The ram usage climbs upward and upward. After 7 hours it uses 700mb of ram.
I managed to comment code until I found the issue. It is located in source/Game/Misc/SpaceBackground.d at line 254.
Code: [Select]
target.draw(star);
I'm drawing a circle shape to a RenderTexture. Comment that line of code and memory usage stabilizes at about 60mb consistently. Keep that line of code in and it climbs above 200mb+ over time.I've attached the source and the executables.
Instructions to run the executables:
(1) Run the server executable.
(2) cd to the Game Executables directory.
(3) Run the Game executable.
(4) Type in letters for the username. Click Enter. Type in letters for the password. Click Enter. Type in letters for a name. Click Enter.
(5) Fly the space ship using the arrow keys. Watch the ram usage. Also notice the missing letters in the text.
Instructions for running from the source:
Use DUB.
Note: The source is using DSFML with the D Language.
I would appreciate ideas for why SFML is failing to render text and uses lots of memory for drawing circle shapes.
Source: http://cl.ly/2H3D3T3A0J2G
Executables: http://cl.ly/2L2v17471u3b