From dougo@ccs.neu.edu Tue Dec 2 17:46:34 1997 From: Doug Orleans To: ldodds@draper.com Cc: lieber@ccs.neu.edu, binoy@ccs.neu.edu, jayantha@ccs.neu.edu, johan@ccs.neu.edu, kedar@ccs.neu.edu, ldodds@draper.com, mira@ccs.neu.edu Subject: Re: limited memory > >I have a few questions: > >- What to do about limited memory. I cannot read in more than 40-50 > >classes at a time. See the manual for the java tool (http://www.javasoft.com/products/jdk/1.1/docs/tooldocs/solaris/java.html). In particular, look at the -mx option. demjava itself uses -mx32m. --Doug From ldodds@ccs.neu.edu Tue Dec 2 22:01:45 1997 cc: Karl Lieberherr Subject: Memory and java class interface questions Doug, I spoke with Prof Lieberherr and he told me to foward these questions to you. I am working on a project to pasre java files and calculate a series of metrics. For some of the metrics I need a collection of Java files. In order to maintain a collection of java files I have added a class to the java.cd file (the one from Binoy) that contains a list of CompilationUnit. This new class is marked noparse. In the beh file I parse each file using the CompilationUnit. Then I add the CompilationUnit to the list of Units by excuting: javaSystem.addElement(unit); where javaSystem is the object of the CompilationUnits and unit the class return from the freshly parsed CompilationUnit. My problem is that because the CompilationUnit is so large, I cannot parse more the 50 files before the virtual machine runs out of memory. Is there anything EASY I can do to solve this problem? I though about serializing the objects and storing them to disk until I need them but that will be rather involved. Can I add more memory to the virtual machine (hack!)? My other problem is dealing with calculating the violations of LoD. When a statement like the following is executed: H h = a.b().c(); The problem is that I would normally look up the b() method and determine the type of object that it returns so I could determine if the c() call is a violation. However, in Java, the b() could return a class that is not in the Java system I am parsing or worse is not available to me in any way. For example what if b() returns a class that is in java.io or java.util. I this case, I have no access to the interface without parsing the .class file. This problem obviously continues with longer chains. Does that seem right? Is there anything I can do? Larry From dougo@ccs.neu.edu Tue Dec 2 22:21:50 1997 Larry Dodds writes: > I spoke with Prof Lieberherr and he told me to foward these questions to > you. I already sent you mail, but it may have been to your other address. > Can I add more memory to the virtual machine (hack!)? Yep, it's a command-line argument to the "java" program: -mx32m will give it 32 megs of heap to work with (that's what I use for demjava itself). > My other problem is dealing with calculating the violations of LoD. When a > statement like the following is executed: > H h = a.b().c(); > > The problem is that I would normally look up the b() method and determine > the type of object that it returns so I could determine if the c() call is > a violation. However, in Java, the b() could return a class that is not > in the Java system I am parsing or worse is not available to me in any > way. For example what if b() returns a class that is in java.io or > java.util. I this case, I have no access to the interface without parsing > the .class file. Demeter considers all external classes (i.e. those not in the class dictionary) to be terminal classes. Thus you shouldn't need to know what methods are on them. > This problem obviously continues with longer chains. Any chain longer than 1 is a violation, isn't it? --Doug