Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


[java] RTTI & Garbage collection Question


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 shaft   Members   -  Reputation: 126

Like
Likes
Like

Posted 13 June 2001 - 07:40 AM

Ok, here''s the situation. I''m working on a game where the end user will be able to create new game objects. Anyways I''m setting it up so that these new objects can spawn objects (e.g. a missile launcher spawns missile objects). Now each of these objects (missile and missile launcher) will reside in different files, and all object files will be loaded at load time. Due to the fact that I''m keeping objects seperate, and each object won''t know what objects actually reside in the system until load time (not compile time) I plan on using the Class class and the forName function. Class missileToSpawn = Class.forName("MyNewMissile"); Now because the MyNewMissile class was loaded into the RTTI at load time this should work fine. My question is -- Is the RTTI ever garbage collected? If so, does it follow that same rules as objects, as long as it is being referenced, it will exist. So by making missileToSpawn variable static, MyNewMissile will always reside in memory, therefore be quick to access? I can''t seem to find anything on the web, and my concern is speed. If the MyNewMissile class ever got garbage collected, the next time I tried to spawn one, there would be file access -- NOT GOOD. P.S. I''m keeping things seperate becuase I want other missile launcher classes be able to spawn this type of missile. But because things are in seperate files, I don''t want the MissileLauncher class to have direct access to MyNewMissile, I don''t know what would happen if someone downloaded the missile launcher class but not the MyNewMissile class. By doing it this way I can make the game engine simply invalidate the missile launcher class if a class by the name of "MyNewMissile" doesn''t exist in memory. I hope this message is clear enough. And thanks in advance if anyone out there can help. -Shaft

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS