Example #1
0
/* A tagged object has been freed */
void Agent::object_free(jvmtiEnv* jvmti, jlong tag)
{
    /* We just cast the tag to a C++ pointer and delete it.
     *   we know it can only be a Monitor *.
     */
    Monitor   *m;
    /*LINTED*/
    m = (Monitor *)(ptrdiff_t)tag;
    if (monitor_count > 1) {
        /* Move the last element to this Monitor's slot */
        int slot = m->get_slot();
        Monitor *last = monitor_list[monitor_count-1];
        monitor_list[slot] = last;
        last->set_slot(slot);
    }
    monitor_count--;
    delete m;
}