This topic is now archived and is closed to further replies.


Windows Task Manager Mem Usage

Recommended Posts

Enokh    122
Hey guys. As some of you prolly know by now from my decent amount of questions lately I''m making a top-down perspective space shooter, and I''ve been changing around the way I save my variables, doing various optimizations and such before I move on to a whole ''nother subject like shooting or collision detection. Anyhow, right now player 1 and 2 can select a spaceship with the number keys for player 1 (0 to 6) and the bottom arrow of keys for player 2 (Z to M). Player 1 moves with the arrow keys and player 2 with WSAD. The ship selection through the keyboard is temporary of course until I get a mainmenu and UI up and running but that''s way down the road, anyhow, here''s some code: if(keys[48]) // keys[48] would be zero on the number keys { keys[48] = FALSE; Player1.PShip.ReadData(0); Player1.PShip.CreateTexture(); Player1.InitPlayer(); } PShip is a Ship class with all sorts of paramters for a ship, like it''s speed, accelration, firepower etc. ReadData(number) reads the data from a ships text file database, the number inputted tells the function where to look inside the text file. CreateTexture() creates a texture into Player1.PShip.texture, from a location that is specified in the Ships database text file, which is of course different for each ship. InitPlayer is basically a constructer (for the player position, current velocity, etc). All the variables involved are static, and exist before those functions are called. Those functions simply change the variables into new values. Here''s the question finally! I start up the game, press 0 once to select a ship, and note down the current Mem Usage of the game (around 24MBs at this time). Then I go back to my game, and hold down 0 for around a minute. Check back the Mem Usage value and it''s waAaaAaayy over 24MBs. 50, 60, and over. Why is the memory usage increasing if all the memory involed is static? There is not a single "new" in any of those functions.

Share this post

Link to post
Share on other sites