void
OMR_MethodDictionary::print()
{
	OMRPORT_ACCESS_FROM_OMRVM(_vm);
	omrtty_printf("OMR Method Dictionary\n");
	omrtty_printf("=====================\n");
	omrtty_printf("%016s %032s %032s %032s %10s\n", "key", "methodName", "className", "fileName", "lineNumber");
	hashTableForEachDo(_hashTable, OMR_MethodDictionary::printEntry, this);
}
void
OMR_MethodDictionary::cleanup()
{
	if (NULL != _vm) {
		omrthread_t self = NULL;
		if (0 == omrthread_attach_ex(&self, J9THREAD_ATTR_DEFAULT)) {
			Trc_OMRPROF_methodDictionaryHighWaterMark(_maxBytes, _maxEntries, _sizeofEntry,
				_maxBytes - (_maxEntries * _sizeofEntry));
			if (NULL != _hashTable) {
				hashTableForEachDo(_hashTable, OMR_MethodDictionary::cleanupEntryStrings, this);
				hashTableFree(_hashTable);
				_hashTable = NULL;
			}
			if (NULL != _lock) {
				omrthread_monitor_destroy(_lock);
				_lock = NULL;
			}
			_vm = NULL;
			omrthread_detach(self);
		}
	}
}
Exemple #3
0
void
GCConfigTest::TearDown()
{
	OMRPORT_ACCESS_FROM_OMRPORT(gcTestEnv->portLib);

	/* Free root hash table */
	hashTableFree(exampleVM->rootTable);
	exampleVM->rootTable = NULL;

	/* Free object hash table */
	hashTableForEachDo(exampleVM->objectTable, objectTableFreeFn, exampleVM);
	hashTableFree(exampleVM->objectTable);
	exampleVM->objectTable = NULL;

	/* close verboseManager and clean up verbose files */
	verboseManager->closeStreams(env);
	verboseManager->disableVerboseGC();
	verboseManager->kill(env);
	if (false == gcTestEnv->keepLog) {
		if (0 == numOfFiles) {
			J9FileStat buf;
			int32_t fileStatRC = -1;
			fileStatRC = omrfile_stat(verboseFile, 0, &buf);
			if (0 == fileStatRC) {
				if (1 == buf.isFile) {
					omrfile_unlink(verboseFile);
				}
			}
		} else {
			for (int32_t seq = 1; seq <= (int32_t)numOfFiles; seq++) {
				char verboseFileSeq[MAX_NAME_LENGTH];
				omrstr_printf(verboseFileSeq, MAX_NAME_LENGTH, "%s.%03zu", verboseFile, seq);
				J9FileStat buf;
				int32_t fileStatRC = -1;
				fileStatRC = omrfile_stat(verboseFileSeq, 0, &buf);
				if (0 > fileStatRC) {
					if (1 != buf.isFile) {
						break;
					}
				}
				omrfile_unlink(verboseFileSeq);
			}
		}
	}
	omrmem_free_memory((void *)verboseFile);

	/* Shut down the dispatcher threads */
	omr_error_t rc = OMR_GC_ShutdownDispatcherThreads(exampleVM->_omrVMThread);
	ASSERT_EQ(OMR_ERROR_NONE, rc) << "TearDown(): OMR_GC_ShutdownDispatcherThreads failed, rc=" << rc;

	/* Shut down collector */
	rc = OMR_GC_ShutdownCollector(exampleVM->_omrVMThread);
	ASSERT_EQ(OMR_ERROR_NONE, rc) << "TearDown(): OMR_GC_ShutdownCollector failed, rc=" << rc;

	/* Detach from VM */
	rc = OMR_Thread_Free(exampleVM->_omrVMThread);
	ASSERT_EQ(OMR_ERROR_NONE, rc) << "TearDown(): OMR_Thread_Free failed, rc=" << rc;

	/* Shut down heap */
	rc = OMR_GC_ShutdownHeap(exampleVM->_omrVM);
	ASSERT_EQ(OMR_ERROR_NONE, rc) << "TearDown(): OMR_GC_ShutdownHeap failed, rc=" << rc;

	printMemUsed("TearDown()", gcTestEnv->portLib);
}