This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 163488 - Objects created by ObjectInputStream.readObject() are not registered
Summary: Objects created by ObjectInputStream.readObject() are not registered
Status: VERIFIED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Base (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Tomas Hurka
URL:
Keywords: VISUALVM
Depends on:
Blocks:
 
Reported: 2009-04-23 14:13 UTC by Tomas Hurka
Modified: 2009-06-05 08:48 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Hurka 2009-04-23 14:13:25 UTC
Objects created by ObjectInputStream.readObject() are not registered by profiler and there such objects are not visible in memory life results or memory 
snapshot.
Comment 1 Tomas Hurka 2009-04-23 15:17:42 UTC
This is day one bug. Below is the test-case:

package javaapplication1;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;


public class Main {


    public static void main(String[] args) throws IOException, ClassNotFoundException {
        int size = 100000;
        int b = 0;
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(stream);
        for (int i = 0; i<size;i++) {
            A a = new A(i);
            oos.writeObject(a);
        }
        ByteArrayInputStream inStrem = new ByteArrayInputStream(stream.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(inStrem);
        for (int i = 0; i<size;i++) {
            A a = (A) ois.readObject();
            if (a != null) {
                b++;
            }
        }
        System.out.println("done "+b);
    }

}

class A implements Serializable {
    int val;

    A(int v) {
        val = v;
    }
}

Profiler should see 200000 allocations of A, but only 100000 is reported.
  
Comment 2 Tomas Hurka 2009-04-23 20:07:52 UTC
Fixed in profiler-main
changeset:   128275:f3b2d11bfa7e
user:        Tomas Hurka <thurka@netbeans.org>
date:        Thu Apr 23 21:06:23 2009 +0200
summary:     bugfix #163488, constructor does not need to be invoked on 'newOpClassName' class; in case of de-serialization the constructor of the first 
non-serializable superclass is invoked instead

Comment 3 Quality Engineering 2009-04-25 07:24:53 UTC
Integrated into 'main-golden', will be available in build *200904250201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/f3b2d11bfa7e
User: Tomas Hurka <thurka@netbeans.org>
Log: bugfix #163488, constructor does not need to be invoked on 'newOpClassName' class; in case of de-serialization the constructor of the first non-serializable superclass is invoked instead
Comment 4 matusdekanek 2009-06-05 08:48:11 UTC
seems ok, makarking 'verified'