Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Memory Leak?
Memory Leak? [message #202671] Thu, 05 May 2005 16:29 Go to next message
Eclipse UserFriend
Originally posted by: james_adams.yahoo.com

It appears that Eclipse has a memory leak. This is based on my
observation of the amount of memory used by "javaw" when Eclipse is
running. The amount just goes up and up, especially if I run Ant tasks
from the "External Tools" menu. Is this a known bug? Is there a way to
modify my Eclipse startup shortcut by adding some extra command line
options so that this will be avoided? It's not the end of the world for
me, but it would be nice to not have to restart Eclipse once or twice a
day.

I'm using Eclipse 3.1M6 on a Windows XP system.


--James
Re: Memory Leak? [message #202679 is a reply to message #202671] Thu, 05 May 2005 17:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

If you are running the Ant tasks within the IDE JVM, then this is
possible. Ant itself doesn't clean itself up completely and leaves
things laying around. If you see this when running Ant in a separate
JVM, then that would be different story.


--
Thanks,
Rich Kulp
Re: Memory Leak? [message #202694 is a reply to message #202679] Thu, 05 May 2005 19:20 Go to previous messageGo to next message
Eclipse UserFriend
"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
news:d5e20v$4ga$1@news.eclipse.org...
> If you are running the Ant tasks within the IDE JVM, then this is
> possible. Ant itself doesn't clean itself up completely and leaves
> things laying around. If you see this when running Ant in a separate
> JVM, then that would be different story.
>
>
> --
> Thanks,
> Rich Kulp

I would be interested in the tasks etc you are using within your Ant build
file that is causing the leaks no matter if you are running in the same JRE
or not.

Thanks
Darins
Re: Memory Leak? [message #202840 is a reply to message #202694] Fri, 06 May 2005 20:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: james_adams.dont_spam_yahoo.com

Below is the build.xml I'm using when running my Ant tasks. Bear in mind
that Eclipse's memory goes up and up whether or not I run my Ant tasks
using the External Tools button, but running the Ant tasks does seem to
accelerate the memory bloat.


--James



<?xml version="1.0" encoding="UTF-8"?>
<project name="grover-hibernate"
default="prepare"
basedir=".">


<!-- Set up properties containing important project directories -->
<property name="source.root"
value="src"/>
<property name="source.java"
value="src/java"/>
<property name="source.mappings"
value="src/mappings"/>
<property name="source.meta"
value="src/META-INF"/>
<property name="source.test"
value="src/test"/>
<property name="class.root"
value="target/classes"/>
<property name="lib.dir"
value="lib"/>
<property name="data.dir"
value="data"/>


<!-- Set up the class path for compilation and execution -->
<path id="project.class.path">
<!-- Include our own classes, of course -->
<pathelement location="${class.root}" />
<!-- Include jars in the project library directory -->
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</path>


<!-- Teach Ant how to use Hibernate's code generation tool -->
<taskdef name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="project.class.path"/>


<!-- Generate the java code for all mapping files in our source tree
-->
<target name="codegen"
depends="prepare"
description="Generate Java source from the O/R mapping files">
<hbm2java output="${source.java}">
<fileset dir="${source.mappings}">
<include name="**/*.hbm.xml"/>
<exclude name="**/Error*.hbm.xml"/>
</fileset>
</hbm2java>
</target>


<!-- Create our runtime subdirectories and copy resources into them -->
<target name="prepare"
description="Sets up build structures">
<mkdir dir="${class.root}"/>
<!-- Remove any existing property files, config files, and O/R
mappings -->
<delete>
<fileset dir="${class.root}">
<include name="**/log4j.properties"/>
<include name="hibernate.cfg.xml"/>
<include name="**/*.hbm.xml"/>
</fileset>
</delete>
<!-- Copy our property files, config files, and O/R mappings for
use at runtime -->
<copy todir="${class.root}" >
<fileset dir="${source.root}" >
<include name="**/log4j.properties"/>
<include name="hibernate.cfg.xml"/>
</fileset>
<fileset dir="${source.mappings}" >
<include name="**/*.hbm.xml"/>
</fileset>
</copy>
</target>


<!-- Compile the Mapping class Java sources of the project -->
<target name="compile"
depends="prepare"
description="Compiles all Mapping Java classes">
<delete>
<fileset dir="${class.root}">
<include name="**/*.class"/>
</fileset>
</delete>
<javac srcdir="${source.java}"
destdir="${class.root}"
debug="on"
optimize="off"
deprecation="on">
<classpath refid="project.class.path"/>
</javac>
</target>


<!-- Generate the database schemas for all mapping files in our class
tree -->
<target name="schema"
depends="prepare"
description="Generate database schemas from the O/R mapping
files">

<!-- Teach Ant how to use Hibernate's schema generation tool -->
<taskdef name="schemaexport"
classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="project.class.path"/>

<!-- Run the schema export task -->
<!-- NOTE - either use

properties="${class.root}/hibernate.properties"
~~ and ~~
a fileset listing the mapping documents (*.hbm.xml)

OR

config="${class.root}/hibernate.cfg.xml"
~~ and ~~
specify the mappings to use in the config file
(hibernate.cfg.xml)
-->
<schemaexport config="${class.root}/hibernate.cfg.xml"
quiet="no"
text="no"
drop="no">
</schemaexport>
</target>


<!-- Compile the Java source of the project -->
<target name="compileTests"
depends="prepare"
description="Compiles all Java test classes">
<javac srcdir="${source.test}"
destdir="${class.root}"
debug="on"
optimize="off"
deprecation="on">
<classpath refid="project.class.path"/>
</javac>
</target>


<!-- Run the PopulateErrorSettings program to populate the
ErrorSettings schema -->
<target name="populateErrorSettings"
description="Creates and persists some sample ErrorSettings"
depends="compile">
<java
classname=" com.harborsideplus.grover.hibernate.misc.PopulateErrorSettin gs "
fork="true">
<classpath refid="project.class.path"/>
</java>
</target>


<!-- Run the ErrorSettingsCreate program to create some sample
ErrorSettings objects -->
<target name="createErrorSettings"
description="Creates and persists some sample ErrorSettings"
depends="compileTests">
<java
classname=" com.harborsideplus.grover.hibernate.misc.ErrorSettingsCreate "
fork="true">
<classpath refid="project.class.path"/>
</java>
</target>


<!-- Run the ErrorSettingsQuery program to query for ErrorSettings -->
<target name="queryErrorSettings"
description="Run some example Hibernate queries for
ErrorSettings"
depends="compileTests">
<java
classname="com.harborsideplus.grover.hibernate.misc.ErrorSettingsQuery "
fork="true">
<classpath refid="project.class.path"/>
</java>
</target>


<!-- Run the TradersQueryTest program to query for Traders -->
<target name="queryTraders"
description="Run some example Hibernate queries for Traders"
depends="compileTests">
<java
classname="com.harborsideplus.grover.hibernate.misc.TradersQuery "
fork="true">
<classpath refid="project.class.path"/>
</java>
</target>


<!-- Package the classes, mapping files, and hibernate-service.xml
into a HAR file -->
<target name="package"
depends="compile">
<delete file="${basedir}/grover-hibernate.har"/>
<jar jarfile="${basedir}/grover-hibernate.har">
<metainf dir="${source.meta}"
includes="**/hibernate-service.xml" />
<!-- include the ErrorSettings and ErrorTextFilter classes -->
<fileset dir="${class.root}">
<include name="**/Error*.class"/>
<exclude name="**/*test*/*"/>
</fileset>
<!-- include the mappings for ErrorSettings and
ErrorTextFilter -->
<fileset dir="${source.mappings}">
<include name="Error*.hbm.xml"/>
</fileset>
</jar>
</target>

</project>
Re: Memory Leak? [message #202856 is a reply to message #202840] Sat, 07 May 2005 18:55 Go to previous messageGo to next message
Eclipse UserFriend
I will try to get to setting this up so that it will work but it would be a
huge help if you have any access to profiling tools if you could do a quick
pass to see what exactly is leaking.

Thanks
Darins

"James Adams" <james_adams@dont_spam_yahoo.com> wrote in message
news:edf68fb67ffb40dab0e24b1cf20a53a9$1@www.eclipse.org...
> Below is the build.xml I'm using when running my Ant tasks. Bear in mind
> that Eclipse's memory goes up and up whether or not I run my Ant tasks
> using the External Tools button, but running the Ant tasks does seem to
> accelerate the memory bloat.
>
>
> --James
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project name="grover-hibernate"
> default="prepare"
> basedir=".">
>
>
> <!-- Set up properties containing important project directories -->
> <property name="source.root"
> value="src"/>
> <property name="source.java"
> value="src/java"/>
> <property name="source.mappings"
> value="src/mappings"/>
> <property name="source.meta"
> value="src/META-INF"/>
> <property name="source.test"
> value="src/test"/>
> <property name="class.root"
> value="target/classes"/>
> <property name="lib.dir"
> value="lib"/>
> <property name="data.dir"
> value="data"/>
>
>
> <!-- Set up the class path for compilation and execution -->
> <path id="project.class.path">
> <!-- Include our own classes, of course -->
> <pathelement location="${class.root}" />
> <!-- Include jars in the project library directory -->
> <fileset dir="${lib.dir}">
> <include name="*.jar"/>
> </fileset>
> </path>
>
>
> <!-- Teach Ant how to use Hibernate's code generation tool -->
> <taskdef name="hbm2java"
> classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
> classpathref="project.class.path"/>
>
>
> <!-- Generate the java code for all mapping files in our source
> tree -->
> <target name="codegen"
> depends="prepare"
> description="Generate Java source from the O/R mapping files">
> <hbm2java output="${source.java}">
> <fileset dir="${source.mappings}">
> <include name="**/*.hbm.xml"/>
> <exclude name="**/Error*.hbm.xml"/>
> </fileset>
> </hbm2java>
> </target>
>
>
> <!-- Create our runtime subdirectories and copy resources into them -->
> <target name="prepare"
> description="Sets up build structures">
> <mkdir dir="${class.root}"/>
> <!-- Remove any existing property files, config files, and O/R
> mappings -->
> <delete>
> <fileset dir="${class.root}">
> <include name="**/log4j.properties"/>
> <include name="hibernate.cfg.xml"/>
> <include name="**/*.hbm.xml"/>
> </fileset>
> </delete>
> <!-- Copy our property files, config files, and O/R mappings for
> use at runtime -->
> <copy todir="${class.root}" >
> <fileset dir="${source.root}" >
> <include name="**/log4j.properties"/>
> <include name="hibernate.cfg.xml"/>
> </fileset>
> <fileset dir="${source.mappings}" >
> <include name="**/*.hbm.xml"/>
> </fileset>
> </copy>
> </target>
>
>
> <!-- Compile the Mapping class Java sources of the project -->
> <target name="compile"
> depends="prepare"
> description="Compiles all Mapping Java classes">
> <delete>
> <fileset dir="${class.root}">
> <include name="**/*.class"/>
> </fileset>
> </delete>
> <javac srcdir="${source.java}"
> destdir="${class.root}"
> debug="on"
> optimize="off"
> deprecation="on">
> <classpath refid="project.class.path"/>
> </javac>
> </target>
>
>
> <!-- Generate the database schemas for all mapping files in our class
> tree -->
> <target name="schema"
> depends="prepare"
> description="Generate database schemas from the O/R mapping
> files">
>
> <!-- Teach Ant how to use Hibernate's schema generation tool -->
> <taskdef name="schemaexport"
> classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
> classpathref="project.class.path"/>
>
> <!-- Run the schema export task -->
> <!-- NOTE - either use
> properties="${class.root}/hibernate.properties"
> ~~ and ~~
> a fileset listing the mapping documents (*.hbm.xml)
> OR
> config="${class.root}/hibernate.cfg.xml"
> ~~ and ~~
> specify the mappings to use in the config file
> (hibernate.cfg.xml)
> -->
> <schemaexport config="${class.root}/hibernate.cfg.xml"
> quiet="no"
> text="no"
> drop="no">
> </schemaexport>
> </target>
>
>
> <!-- Compile the Java source of the project -->
> <target name="compileTests"
> depends="prepare"
> description="Compiles all Java test classes">
> <javac srcdir="${source.test}"
> destdir="${class.root}"
> debug="on"
> optimize="off"
> deprecation="on">
> <classpath refid="project.class.path"/>
> </javac>
> </target>
>
>
> <!-- Run the PopulateErrorSettings program to populate the
> ErrorSettings schema -->
> <target name="populateErrorSettings"
> description="Creates and persists some sample ErrorSettings"
> depends="compile">
> <java
> classname=" com.harborsideplus.grover.hibernate.misc.PopulateErrorSettin gs "
> fork="true">
> <classpath refid="project.class.path"/>
> </java>
> </target>
>
>
> <!-- Run the ErrorSettingsCreate program to create some sample
> ErrorSettings objects -->
> <target name="createErrorSettings"
> description="Creates and persists some sample ErrorSettings"
> depends="compileTests">
> <java
> classname=" com.harborsideplus.grover.hibernate.misc.ErrorSettingsCreate "
> fork="true">
> <classpath refid="project.class.path"/>
> </java>
> </target>
>
>
> <!-- Run the ErrorSettingsQuery program to query for ErrorSettings -->
> <target name="queryErrorSettings"
> description="Run some example Hibernate queries for
> ErrorSettings"
> depends="compileTests">
> <java
> classname="com.harborsideplus.grover.hibernate.misc.ErrorSettingsQuery "
> fork="true">
> <classpath refid="project.class.path"/>
> </java>
> </target>
>
>
> <!-- Run the TradersQueryTest program to query for Traders -->
> <target name="queryTraders"
> description="Run some example Hibernate queries for Traders"
> depends="compileTests">
> <java
> classname="com.harborsideplus.grover.hibernate.misc.TradersQuery "
> fork="true">
> <classpath refid="project.class.path"/>
> </java>
> </target>
>
>
> <!-- Package the classes, mapping files, and hibernate-service.xml into
> a HAR file -->
> <target name="package"
> depends="compile">
> <delete file="${basedir}/grover-hibernate.har"/>
> <jar jarfile="${basedir}/grover-hibernate.har">
> <metainf dir="${source.meta}"
> includes="**/hibernate-service.xml" />
> <!-- include the ErrorSettings and ErrorTextFilter classes -->
> <fileset dir="${class.root}">
> <include name="**/Error*.class"/>
> <exclude name="**/*test*/*"/>
> </fileset>
> <!-- include the mappings for ErrorSettings and
> ErrorTextFilter -->
> <fileset dir="${source.mappings}">
> <include name="Error*.hbm.xml"/>
> </fileset>
> </jar>
> </target>
>
> </project>
>
>
>
Re: Memory Leak? [message #202864 is a reply to message #202694] Sun, 08 May 2005 02:50 Go to previous messageGo to next message
Eclipse UserFriend
Darin,

I've been using VisualGC tool to monitor Eclipse memory and noticed
that Ant executios cause a lot of classloading. That heavily hit PermGen
space, which is not expanded by VM and usually maxed to something like
64Mb on 1.4.2 VM. Most of those classes are unloaded after execution but
not all of them. It also seems that problem is worse on Eclipse 3.1 then
on 3.0. I can say this because we have added and builders to about 20
projects in thhe workspace and when I do complete rebuild without
adjusting PermGen allocation I'm constantly getting an out of memory
error on 3.1 but not on 3.0. If I'm not mistaken, there was some changes
in Ant's classloader between versions used for 3.0 and 3.1, but that is
only my guess.

regards,
Eugene


Darin Swanson wrote:

>"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
>news:d5e20v$4ga$1@news.eclipse.org...
>
>
>>If you are running the Ant tasks within the IDE JVM, then this is
>>possible. Ant itself doesn't clean itself up completely and leaves
>>things laying around. If you see this when running Ant in a separate
>>JVM, then that would be different story.
>>
>>
>>--
>>Thanks,
>>Rich Kulp
>>
>>
>
>I would be interested in the tasks etc you are using within your Ant build
>file that is causing the leaks no matter if you are running in the same JRE
>or not.
>
>
Re: Memory Leak? [message #202881 is a reply to message #202856] Sun, 08 May 2005 17:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: james_adams.dont_spam_yahoo.com

I'm sorry Darin, I don't have access to a profiler.

--James
Re: Memory Leak? [message #202889 is a reply to message #202864] Mon, 09 May 2005 00:19 Go to previous message
Eclipse UserFriend
Thanks Eugene.

Yes Ant causes lots of classes to be loaded if you are running in the same
JRE as Eclipse...each build creates a new classloader and reloads the Ant
classes.

I plan to make the time to do more profiling but in recent tests that I have
done on 3.1 I am not seeing problems.
Of course each Ant buildfile is different and will result in different
classes being loaded and possibly different memory leaks...possibly from the
Apache Ant implementation or from the Eclipse integration.

The interesting part is which classes are not unloaded and why...

Darins

"Eugene Kuleshov" <eu@md.pp.ru> wrote in message
news:427DB6D2.2040503@md.pp.ru...
> Darin,
>
> I've been using VisualGC tool to monitor Eclipse memory and noticed that
> Ant executios cause a lot of classloading. That heavily hit PermGen space,
> which is not expanded by VM and usually maxed to something like 64Mb on
> 1.4.2 VM. Most of those classes are unloaded after execution but not all
> of them. It also seems that problem is worse on Eclipse 3.1 then on 3.0. I
> can say this because we have added and builders to about 20 projects in
> thhe workspace and when I do complete rebuild without adjusting PermGen
> allocation I'm constantly getting an out of memory error on 3.1 but not on
> 3.0. If I'm not mistaken, there was some changes in Ant's classloader
> between versions used for 3.0 and 3.1, but that is only my guess.
>
> regards,
> Eugene
>
>
> Darin Swanson wrote:
>
>>"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
>>news:d5e20v$4ga$1@news.eclipse.org...
>>
>>>If you are running the Ant tasks within the IDE JVM, then this is
>>>possible. Ant itself doesn't clean itself up completely and leaves
>>>things laying around. If you see this when running Ant in a separate
>>>JVM, then that would be different story.
>>>
>>>
>>>--
>>>Thanks,
>>>Rich Kulp
>>>
>>
>>I would be interested in the tasks etc you are using within your Ant build
>>file that is causing the leaks no matter if you are running in the same
>>JRE
>>or not.
>>
Previous Topic:When JDT will support features from JDK 1.5/5.0?
Next Topic:JDT Search caching
Goto Forum:
  


Current Time: Mon May 12 08:53:07 EDT 2025

Powered by FUDForum. Page generated in 0.05204 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top