RSAutoreleaseZone::RSAutoreleasePage::~RSAutoreleasePage()
{
    selfCheck();
    unprotect();
    assert(empty());
    
    // Not recursive: we don't want to blow out the stack
    // if a thread accumulates a stupendous amount of garbage
    assert(!child);
}
Beispiel #2
0
bool 
Madara::AgentContext::selfCheck (const std::string& host, u_short u_port)
{
  char port_buf[16];
  std::string port;

  // convert the server_port into string form for our context
  itoa (u_port, port_buf, 10);
  port = port_buf;

  return selfCheck (host, port);
}
Beispiel #3
0
static void JNICALL dumperThreadMain(__UNUSED__ jvmtiEnv* jvmti, JNIEnv* jni_env, __UNUSED__ void* arg)
{
	char* internalLeaksString;

    if (JNI_FALSE != __sync_lock_test_and_set(&gdata->dumpInProgress, JNI_TRUE))
    {
    	alert("Another dump is already in progress");
    	return;
    }
	gdata->numberOfLeaks = 0;
	initThreadData(jni_env);

	if (gdata->run_gc)
	{
		jvmtiError err;
    	debug("jleaker: Running garbage collection\n");
    	err = (*jvmti)->ForceGarbageCollection(jvmti);
    	if (err) alert("jleaker: Failed to run GC\n");
	}

    establish_connection(gdata->tcp_port);

    begin_xml_output();
    open_xml_element("memory-leaks", NULL);

	startTimer(&getThreadData()->timer, 0);

	tagAllMapsAndCollections();
	findLeaksInTaggedObjects();

	close_xml_element("memory-leaks");

	close_connection();

	stopTimer(&getThreadData()->timer, "Finished leak detection");
    releaseThreadData();
    
	internalLeaksString = findInternalMallocsLeaks();
    if (NULL != internalLeaksString)
    {
		alert("Internal jleaker error: %s\n", internalLeaksString);
		free(internalLeaksString);
    }
    if (gdata->self_check)
    {
    	selfCheck();
    }
	gdata->dumpInProgress = JNI_FALSE;
}
Beispiel #4
0
int main(const int argc, const char* argv[]) {
    if (argc == 2) {
        if (strcmp(argv[1], "--verbose") == 0) {
            verbose_mode = 1;
        }
    }

    prepare();
    clearSupplementaryGroups();
    selfCheck();

    struct libmnt_table* mt = mnt_new_table_from_file("/opt/xware_desktop/mounts");
    if (mt == NULL) {
        fprintf(stderr, "mnt_new_table_from_file failed.\n");
        exit(EXIT_FAILURE);
    }
    struct libmnt_iter* itr = mnt_new_iter(MNT_ITER_FORWARD);
    struct libmnt_fs* fs = NULL;

    while(1) {
        int tmp = mnt_table_find_next_fs(mt, itr, &matchAll, NULL, &fs);
        if (tmp < 0) { // error
            fprintf(stderr, "mnt_table_find_next_fs failed.\n");
            break;
        } else {
            if (tmp == 1) { // reach EOF
                break;
            }
            const char* target = mnt_fs_get_target(fs);
            if (target == NULL) {
                fprintf(stderr, "mnt_fs_get_target failed.\n");
            } else {
                printf("%s%s%s\n", BOLD, target, NOSTYLE);
                printf("================================\n");
                if (checkDirXPermissions(target)) {
                    checkTargetDirPermissions(target);
                }
                printf("\n");
            }
        }
    }
    printf("%s", NOSTYLE);
    mnt_free_fs(fs);
    mnt_free_iter(itr);
    mnt_free_table(mt);
    return 0;
}