ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Abley <james.ab...@volantis.com>
Subject Re: Memory Leak on Solaris?
Date Wed, 10 May 2006 11:38:40 GMT
Hi Ritesh,

Have you profiled your application?

Cheers,

James

Scot P. Floess wrote:
> Ritesh:
> 
> In just examining your code fragment, it wouldn't appear you are doing 
> anything out of the ordinary (to cause a memory leak).  At a high level, 
> what does this app do specifically?  Perhaps the failure is in another 
> part of of your app (causing the out-of-memory issue)?  Is it possible, 
> for instance, you are caching data in such a way that under Solaris 
> there is more data and, for whatever reason, less data under Windows?  I 
> could see a such a scenario where maybe on the Solaris machine you go 
> seek out all files starting in / and store in an array, but under 
> Windows you start in some other directory which yields a much smaller 
> array - again just an example.  For the most part you state Solaris runs 
> out of memory but its still hard to determine how "exact" your 
> environment is between Solaris and Windows and what your app does.
> 
> Something else too...I would -hope- that your java app isn't somehow 
> doing one thing for Windows and another for Solaris.  It looks like your 
> are running Sun's VM for both Windows and Solaris.  With that said, I 
> would expect the Solaris version to be the same, or better, than the 
> Windows implementation ;)
> 
> Scot
> 
> Ritesh Trivedi wrote:
> 
>> 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
>>
>>
> 


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


Mime
View raw message