In the context of game dev, what is the preferred memory to use to store structs like Entities or MapData which are large in size and have lifetimes lasting the entire game run-time.
For example here is a entity struct I use that is on stack memory. Shall I let it remain on the stack or move it to an Memory Arena I am making to store map data in my game.
typedef struct {
/*
The 0th index is reserved for the player and shall not ever turn in the
entity_empty_slots array.
*/
SDL_FRect entity_bounding_boxes[ENTITY_POOL_SIZE];
SDL_Color entity_colors[ENTITY_POOL_SIZE];
EntityType entity_types[ENTITY_POOL_SIZE];
float entity_speeds[ENTITY_POOL_SIZE];
Meter entity_health_meters[ENTITY_POOL_SIZE];
/*
Indices which can new entities spawn into.
This is a stack data structure of the empty indices.
This follows the LIFO principle.
*/
IntArr entity_empty_slots;
/*
Used to selectively access indices that are occupied
Used in collision detection using a trick called:
Sort Sweep and Prune.
Reference Article: https://leanrada.com/notes/sweep-and-prune/
*/
IntArr entity_occupied_slots;
} Entities;
Here the ENTITY_POOL_SIZE = 51 and the IntArr is:
typedef struct {
int32_t arr[ENTITY_POOL_SIZE];
int32_t len;
}