I'm working on an Allegro 5 game and have some huge memory problems. The game is a Roguelike Shmup where every visual asset is made from ASCII characters, this means that every visual element has originated from a .ttf font file and a series of chars or strings.
So from the GIF above, it all looks good. The game also has a level generator and the ability for a player to move around and collide with the walls, and there's even enemies and items to interact with. The problem lies when I saw it running in the Windows Task Manager:
I decided to let it run through Visual Studio's Memory Usage Profiler to see where this 1.8GB RAM usage is coming from, and this is what I find:
So it appears a lot of memory is being used in allocating and destroying data within the allegro library.
My best theory so far as to why I've got this huge memory load is because of the way I'm creating the visual assets. In order to make it possible to create more visually interesting assets and reduce the amount of text rendering calls, I instead create and render bitmaps. The string of characters are then drawn onto the bitmaps in a process like this:
bitmap = al_create_bitmap(
15ALLEGRO_FONT* font = al_load_ttf_font("Assets\\lucon.ttf"
ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA);
, ALLEGRO_ALIGN_CENTRE, "@");
ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA);
This way each object, including a Particle System, will use a bitmap each. instead of one to many text draw calls.
So this will probably be obvious, but considering you know the framework more than I do, I was wondering if you have any advice for what could be causing the issue based on the above evidence, and any way I can do it better so it won't require at least 2GB of memory to run.