开发者

Implement an Explecit Garbage Collection Algorithm in Java [closed]

开发者_运维知识库 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

Yesterday i have just heard a lecture about garbage collection in java."Basics of Garbage Collection" on You Tube , so i was trying to implement my own garbage collection algorithm.So i just wanted to have any one implemented it.Is there a way to do it ? If yes can you please help me out with it. Thanks -Sagar S.


For implementing your own garbage collection, you also have to implement a complete Java VM, since they are quite woven into each other.

  • For the garbage collector to have anything to do, it needs some Java objects.
  • For the Java objects to be useful (and to be able to allocate them), you need to execute Java code.

So, if you want to implement this in Java, you would have to create a Java virtual machine based on Java.

Good luck :-)


If you only want to create a garbage collector for an existing VM, look at the open source ones like OpenJDK, GJC, Apache Harmony. I think they are modularized sufficiently so you could plug in another GC implementation there - you still have to make sure it fits to the memory allocation algorithm, and everything that accesses objects. You would have to implement this in the same language like the VMs themselves, I suppose (so mainly C or C++).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜