Description
Recent runs of jdktools show unstable tests that sometimes crash in GetLoadedClasses function. The reason is that the number of reported classes from classloader tables is bigger than memory allocated for them. It happens because some classes may be loaded between the count of loaded classes it known and filling up the reported array. In debug mode assertion "number == count" often fails for this reason ("count" is the number of classes determined for allocating memory, "number" is the number of actually reported classes).
Attached patch adds synchronization to these functions. Tests work stably for me now. I would really like to commit this fix in M4, so marking this bug as M4.