ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ritesh Trivedi" <ritesh.triv...@gmail.com>
Subject Re: Memory Leak on Solaris?
Date Tue, 09 May 2006 18:10:36 GMT
I am starting my app from command line

e.g. java [OPTIONS] -jar myjar.jar [my commandline args]

I have tried both, with and without Xms and Xmx options. It still leaks.

My app basically "executes" ant targets from within the app (cant
really mention what app does). I am using the following code fragment
to execute ant target

        Project project = new Project();
        ProjectHelper helper = null;
        DefaultLogger logger = new DefaultLogger();

        logger.setMessageOutputLevel(Project.MSG_INFO);
        logger.setOutputPrintStream(System.out);
        logger.setErrorPrintStream(System.err);
        project.addBuildListener(logger);

        File buildFile = new File(buildFilePath);
        Throwable exception = null;

        try
        {
            project.fireBuildStarted();
            project.init();

            helper = ProjectHelper.getProjectHelper();
            String[] properties = getPropertyNames();

            if (_log.isDebugEnabled())
                LangUtil.printArray(" Combined Properties ", properties);

            if (!LangUtil.isEmptyOrNull(properties))
            {
                int numProperties = properties.length;

                for(int i=0; i<numProperties; i++)
                    project.setProperty(properties[i],
getPropertyValue(properties[i]).toString());
            }
            helper.parse(project, buildFile);

            if (StringUtil.isEmptyOrNull(target))
                project.executeTarget(project.getDefaultTarget());
            else
                project.executeTarget(target);


            setProperties(project.getProperties());
        }
        catch (Exception bex)
        {
            exception = bex;
            _error = true;
            if (_log.isErrorEnabled())
                _log.error("Error processing build script " + bex.toString());
        }
        finally
        {
            if (project != null)
            {
                project.fireBuildFinished(exception);
                project.removeBuildListener(logger);
                logger = null;
                project = null;
            }
            helper = null;
        }

> How are you starting your java app?  Are you using any memory options?
> What does your app do?  Sorta difficult to say for sure without more
>information.

Ritesh Trivedi wrote:
> Hi,
>
> I am using j2sdk 1.4.2_10 and Ant 1.6.5. I am using Ant Java API and
> calling and executing Ant target from within my java program. I am
> seeing Out Of Memory errors on Solaris on Windows 2000 it works
> perfectly fine - no leaks.
>
> Any advise or pointers?
>
> Thanks
> Ritesh
>
> On 7/18/05, Ritesh Trivedi <ritesh.trivedi@gmail.com> wrote:
>> Hi,
>>
>> I am experiencing memory leak while executing Ant targets multiple
>> times from java program. It seems to me that the classloader instances
>> are lying around and takes heap space for each run.
>>
>> Any fixes for the issue?
>>
>> Thanks
>> Ritesh
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

--
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim



On 5/8/06, Ritesh Trivedi <ritesh.trivedi@gmail.com> wrote:
> Hi,
>
> I am using j2sdk 1.4.2_10 and Ant 1.6.5. I am using Ant Java API and
> calling and executing Ant target from within my java program. I am
> seeing Out Of Memory errors on Solaris on Windows 2000 it works
> perfectly fine - no leaks.
>
> Any advise or pointers?
>
> Thanks
> Ritesh
>
> On 7/18/05, Ritesh Trivedi <ritesh.trivedi@gmail.com> wrote:
> > Hi,
> >
> > I am experiencing memory leak while executing Ant targets multiple
> > times from java program. It seems to me that the classloader instances
> > are lying around and takes heap space for each run.
> >
> > Any fixes for the issue?
> >
> > Thanks
> > Ritesh
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message