As we discussed verbally, I suggest adding a line like this at the beginning of every low-level MemberNameTable access function:
assert_locked_or_safepoint(MemberNameTable_lock); (I'm modeling this from SystemDictionary::find_class and its brothers.) The rest of it looks good. Reviewed! — John On Apr 15, 2013, at 10:59 AM, serguei.spit...@oracle.com wrote: >> >> b) do we need to use the MemberNameTable_lock to guard this? > > I don't think so. > This deallocation must be done at a safepoint. > We can't grab locks at safepoints. > > These are the details: > > classLoaderData.cpp: > > // Deallocate free metadata on the free list. How useful the PermGen was! > void ClassLoaderData::free_deallocate_list() { > // Don't need lock, at safepoint > assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint"); > . . . > } else if (m->is_klass()) { > MetadataFactory::free_metadata(this, (InstanceKlass*)m); > . . . > } > > metadataFactory.hpp: > > // Deallocation method for metadata > template <class T> > static void free_metadata(ClassLoaderData* loader_data, T md) { > if (md != NULL) { > . . . > md->deallocate_contents(loader_data); > loader_data->metaspace_non_null()->deallocate((MetaWord*)md, size, > md->is_klass()); > } > } > > instanceKlass.cpp: > > void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) { > . . . > release_C_heap_structures(); > . . . > }