   A game design question.
  I have a dilemma over a game design problem. I am a beginner in gamesdevelopment and working on an RPG type game, purely experimental for thepurpose of learning the basics of game development. My implementation is in C++language.The problem I am about to discuss is that for instance in a game world, youhave items such as weapons, armour and other stuffs that can be carried by aplayer or vendor. My question is should I globally maintain a list of everyitem created in the game or should I just create and store these items in theirrespective context, such as the player's inventory, the vendor's vector ofitem objects, and so on.I would ask questions like, if I keep such a huge list of all objects createdand destroyed dynamically, would this impact on the efficiency of the game? IfI do not maintain such a list, how am I supposed to know what items werecreated and destroyed at any time in a game or how many items are currentlycreated in game and so on? Without these statistics is it really ok?If I were to create such a global list, do I use a Factory design patternwith a vector or list of item objects to keep track of what I have createdor destroyed?Maybe I got this whole design idea wrong. Can someone help me out?Thanks.   
  You could remove the need for freeing the memory by using hans boehm's garbage collector. That would allow you more moving space.Have you thought about the idea that you do not actually have any global space where to store stuff? Instead, you would have a kind of multi-set, indexed so that searching for items owned by object in your simulation would be dead easy.so, this set would contain this kind of data domains:||| void* owner | Item* item ||| plus other information you'd possibly like to store with your items (how are they stored? is the relationship secret? etc.). If you'd possibly use GC, you could just drop items out from map when they dies.This is could be called relational oriented model. In player class, you possibly know some information (for example if player can only wear one item of kind, you'd have pointer to his armor object there). When player object dies, you just do the logic which handles what happens for his items in the simulation.You can easily add counter or something to show how many items were created and such, into item constructors.Just brainstorming from my paradigm twisted mind. :) Try different things and see out how they behaves, then choose one which is best for you.   