void
site_heapdump(JNIEnv *env)
{
   
    rawMonitorEnter(gdata->data_access_lock); {

        jvmtiHeapCallbacks heapCallbacks;
        
        /* Remove class dumped status, all classes must be dumped */
        class_all_status_remove(CLASS_DUMPED);

        /* Clear in_heap_dump flag */
        tls_clear_in_heap_dump();
        
        /* Dump the last thread traces and get the lists back we need */
        tls_dump_traces(env);
       
        /* Write header for heap dump */
        io_heap_header(gdata->total_live_instances, gdata->total_live_bytes);

        /* Setup a clean reference table */
        reference_init();
        
        /* Walk over all reachable objects and dump out roots */
        gdata->gref_serial_number_counter = gdata->gref_serial_number_start;

        /* Issue thread object for fake non-existent unknown thread
         *   just in case someone refers to it. Real threads are handled
         *   during iterate over reachable objects.
         */
        io_heap_root_thread_object(0, gdata->unknown_thread_serial_num, 
                        trace_get_serial_number(gdata->system_trace_index));

        /* Iterate over heap and get the real stuff */
        (void)memset(&heapCallbacks, 0, sizeof(heapCallbacks));

        /* Select callbacks */
        heapCallbacks.heap_reference_callback       = &cbReference;
        if ( gdata->primfields == JNI_TRUE ) {
            heapCallbacks.primitive_field_callback  = &cbPrimFieldData;
        }
        if ( gdata->primarrays == JNI_TRUE ) {
            heapCallbacks.array_primitive_value_callback  = &cbPrimArrayData;
        }
        followReferences(&heapCallbacks, (void*)NULL);

        /* Process reference information. */
        object_reference_dump(env);
        object_clear_references();
        reference_cleanup();

        /* Dump the last thread traces and get the lists back we need */
        tls_dump_traces(env);

        /* Write out footer for heap dump */
        io_heap_footer();
        
    } rawMonitorExit(gdata->data_access_lock);
}
Exemple #2
0
void
site_heapdump(JNIEnv *env)
{
   
    rawMonitorEnter(gdata->data_access_lock); {
	
	struct { int i; } user_data; /* FIXUP */

	user_data.i = 0;

	/* Remove class dumped status, all classes must be dumped */
	class_all_status_remove(CLASS_DUMPED);

	/* Clear in_heap_dump flag */
	tls_clear_in_heap_dump();

	/* Dump the last thread traces and get the lists back we need */
	tls_dump_traces(env);
       
	/* Write header for heap dump */
	io_heap_header(gdata->total_live_instances, gdata->total_live_bytes);

	/* Setup a clean reference table */
	reference_init();
	
	/* Walk over all reachable objects and dump out roots */
	gdata->gref_serial_number_counter = gdata->gref_serial_number_start;

	/* Issue thread object for fake non-existent unknown thread
	 *   just in case someone refers to it. Real threads are handled
	 *   during iterate over reachable objects.
	 */
	io_heap_root_thread_object(0, gdata->unknown_thread_serial_num, 
			trace_get_serial_number(gdata->system_trace_index));

	/* Iterate over heap and get the real stuff */
	iterateOverReachableObjects(&root_object, &stack_object, 
			&reference_object, (void*)&user_data);

	/* Process reference information. */
	object_reference_dump(env);
	object_clear_references();
        reference_cleanup();

	/* Dump the last thread traces and get the lists back we need */
	tls_dump_traces(env);

	/* Write out footer for heap dump */
	io_heap_footer();
	
    } rawMonitorExit(gdata->data_access_lock);
}
Exemple #3
0
void
site_heapdump(JNIEnv *env)
{
   
    rawMonitorEnter(gdata->data_access_lock); {
	
	struct { int i; } user_data; /* FIXUP */

	user_data.i = 0;
    
	/* Dump the last thread traces and get the lists back we need */
	tls_dump_traces(env);
       
	/* Write header for heap dump */
	io_heap_header(gdata->total_live_instances, gdata->total_live_bytes);

	/* Write out the thread roots first (threads that ended already did) */
	tls_output_heap_threads();

	/* Setup a clean reference table */
	reference_init();
	
	/* Walk over all reachable objects and dump out roots */
	gdata->gref_serial_number_counter = gdata->gref_serial_number_start;
	iterateOverReachableObjects(&root_object, &stack_object, &reference_object, (void*)&user_data);

	/* Process reference information. */
	object_reference_dump(env);
	object_clear_references();
        reference_cleanup();

	/* Dump the last thread traces and get the lists back we need */
	tls_dump_traces(env);

	/* Write out footer for heap dump */
	io_heap_footer();
	
    } rawMonitorExit(gdata->data_access_lock);
}