Bug 35636 - Compiler running into memory problems
Summary: Compiler running into memory problems
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P2 enhancement (vote)
Target Milestone: 1.2   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-25 06:11 EST by jean safar CLA
Modified: 2004-02-19 08:39 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jean safar CLA 2003-03-25 06:11:30 EST
Hi, 

Firstly, I am just getting on AspectJ, so apologies in advance for any (stupid) 
mistake on my part. 

The following aspect I am testing ( to time RMI messages ) does compilte fine 
on its own. However, when I submit to the compiler an "injar" of byte source 
classes, the compiler chokes with an OutOfMemoryError: 

I then tried the compiler and gave it the original source of that byte code and 
it does fail again this time indicating an internal compiler error when at line 
0 of a source file (where this is just the opening comment "/*" ...) (I need to 
obfuscate the commercial code stuff .. sorry). 

Thanx in advance

bash-2.05b$ ajc -1.4 -verbose -argfile achatvente.lst -
sourceroots "src;../thirdparty/src" -outjar achatvente.
jar
zipfile classpath entry does not exist: c:\j2sdk1.4.1_01\jre\lib\i18n.jar
directory classpath entry does not exist: c:\j2sdk1.4.1_01\jre\classes
java.lang.OutOfMemoryError
C:\development\thirdparty\src\com\product\MyFile.java:0 Internal compiler error
java.lang.OutOfMemoryError


!! no source information available !!
ABORT
Exception thrown from AspectJ 1.1rc1

This might be logged as a bug already -- find current bugs at
  http://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Compiler

Bugs for exceptions thrown have titles File:line from the top stack,
e.g., "SomeFile.java:243"

If you don't find the exception below in a bug, please add a new bug
at http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
To make the bug a priority, please include a test program
that can reproduce this exception.
null
java.lang.OutOfMemoryError


1 fail|abort, 1 error


import java.rmi.server.RemoteRef;
import java.rmi.Remote;
import java.lang.reflect.*;
aspect RemoteObjectAspect {
    Object around (Remote remote, Method method, Object[] objectArray, long 
long3) :  call(Object RemoteRef.invoke(..)) && args(remote, method, 
objectArray, long3) {
           long start = new java.util.Date().getTime () ;
           Object ret = proceed (remote, method, objectArray, long3) ;
           start = new java.util.Date().getTime () - new java.util.Date
().getTime () ;
           // Log the time wherever needed.
           System.err.println ("Timed Method: " + method + " on object " + 
remote + " ... TIME (ms) : " + start) ;
           return ret ;
    }
}
Comment 1 jean safar CLA 2003-03-25 08:25:21 EST
Hi, 

Looking again at the bug db, it seems that this bug is caused by the 1000 file 
limit I have seen in the bug list as it does happen after a few files are being 
treated. 

regards,
Comment 2 Jim Hugunin CLA 2003-03-27 12:57:10 EST
There is no hard limit on the number of files that ajc can handle.  However, 
ajc is known to use more memory than javac.  See the FAQ entry on 
OutOfMemoryError for more information on solutions to this problem.  We should 
modify the error handling in the compiler so that an OutOfMemoryError will 
point people to the FAQ (we did this in 1.0).  I'll leave the bug open until 
that is done.

You can find the FAQ entry at:
http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-
home/doc/faq.html#q:ajcoom
Comment 3 Jim Hugunin CLA 2003-04-08 16:31:51 EDT
*** Bug 36234 has been marked as a duplicate of this bug. ***
Comment 4 Adrian Colyer CLA 2004-02-19 08:39:16 EST
Memory problems in the compiler are now handled in a much more graceful way (see 
resolution of bug 36234. Separate bug 35547 is tracking the issue of reducing 
the amount of memory that AspectJ needs.