I'm looking at the possibility of generating Java byte code at run time (hopefully directly in memory rather than via class files, though I imagine that won't make a difference to my question).
I understand this can be done, the question is, does the garbage collector sweep up no-longer-used code? I remember some years ago seeing it claimed that it did not, but I can't now find any references to the topic.
To clarify the purpose of this, I certainly wouldn't bother for ordinary data processing scenarios. But consider genetic programming: potentially billions of small programs generated and run for trillions of executions; in that scenario it's worth trying to make things run as fast as possible, and freeing up no longer used code is important. I'm trying to do something more complex, but it has similarities to genetic programming.