Hi Mili,

Calling Runtime.gc() as you are doing signals the Garbage Collector to
collect garbage as soon as possible. Afaik that's all you can do. However,
"as soon as possible" gives absolutely no guarantees, so you can't rely on
it doing it "on time".
You can try calling Thread.yield() after calling Runtime.gc() at the end of
each iteration in your for loop. That will take your own thread out of the
equation and perhaps give the garbage collector the chance to run. Again, no
guarantees.

Setting all pointers to an object to null, as you seem to be doing, signals
the garbage collector that that object can be garbage collected. If it's not
collecting it, perhaps there are other pointers still pointing to it,
perhaps as instance variables in other active objects in your application?

Good luck,
Frans


> -----Original Message-----
> From: Mili Aggarwal, Noida [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 06, 2005 8:18 AM
> To: POI Users List
> Subject: RE: Out of Memory Error
> 
> 
> Hey,that made sense.......Thanks a lot..but how do you 
> explicitly deallocate
> memeory.I make the the instance of workbook null....after every
> creation..Any other way? And how to make gc a high priority process.
> 
> 
> Warm Regards,
> Mili Aggarwal
> HCL TECHNOLOGIES LTD.
> Noida, India.
> Tel: +91 (0120) 2516321/328 Extn: 1052
> Email: [EMAIL PROTECTED]
> 
> --------------------------------------------------------------
> --------------
> -----------------------------DISCLAIMER-----------------------
> --------------
> --------------------------------------------------------------
> --------------
> --------
> 
> This message and any attachment contained here are information that is
> confidential, proprietary to HCL Technologies and its 
> customers. Contents
> may be privileged or otherwise protected by law. The 
> information is solely
> intended for the individual or the entity it is addressed to. 
> If you are not
> the intended recipient of this message, you are not 
> authorized to read,
> forward, print, retain, copy or disseminate this message or 
> any part of it.
> If you have received this e-mail in error, please notify the sender
> immediately by return e-mail and delete it from your computer.
> 
> 
> 
> 
> -----Original Message-----
> From: Vyom Tewari [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, April 06, 2005 11:02 AM
> To: POI Users List
> Subject: Re: Out of Memory Error
> 
> I ur program u r creating different workbook so when u 
> finished ur  one
> workbook save it and deallocate memory used by that workbook, 
> since u r
> saving different work book in different files  so there is no 
> problem at
> all.I think what u r doing is just create instance of 
> workbook inside loop
> so gc which is low priority process is not able to dallocate memory.
> 
> 
> 
> ----- Original Message ----- 
> From: "Mili Aggarwal, Noida" <[EMAIL PROTECTED]>
> To: "POI Users List" <poi-user@jakarta.apache.org>
> Sent: Wednesday, April 06, 2005 10:46 AM
> Subject: RE: Out of Memory Error
> 
> 
> > I a printing both total memeory and free memeory in program 
> to see how
> much
> > is the memeory being used.What I observed as a peculiar 
> behaviour was
> after
> > the total memeory reaches its MAXIMUM ,the gc (garbage 
> collector) stops
> > working and free memory keeps reducing till it ultimately 
> falls short of
> > ememory.Any pointers as to why is it happenning?
> >
> > Warm Regards,
> > Mili Aggarwal
> > HCL TECHNOLOGIES LTD.
> > Noida, India.
> > Tel: +91 (0120) 2516321/328 Extn: 1052
> > Email: [EMAIL PROTECTED]
> >
> > 
> --------------------------------------------------------------
> ------------
> --
> > 
> -----------------------------DISCLAIMER-----------------------
> ------------
> --
> > 
> --------------------------------------------------------------
> ------------
> --
> > --------
> >
> > This message and any attachment contained here are 
> information that is
> > confidential, proprietary to HCL Technologies and its 
> customers. Contents
> > may be privileged or otherwise protected by law. The 
> information is solely
> > intended for the individual or the entity it is addressed 
> to. If you are
> not
> > the intended recipient of this message, you are not 
> authorized to read,
> > forward, print, retain, copy or disseminate this message or 
> any part of
> it.
> > If you have received this e-mail in error, please notify the sender
> > immediately by return e-mail and delete it from your computer.
> >
> >
> >
> > -----Original Message-----
> > From: Vyom Tewari [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, April 06, 2005 10:30 AM
> > To: POI Users List
> > Subject: Re: Out of Memory Error
> >
> > This is because of OLE 2.0 , ole 2.0 don't support partial 
> file writing so
> > if u want to write big file which have multiple sheet all 
> the sheet should
> > have in more memory that's why u get out of memory problem. 
> and POI itself
> > lack in memory management capabilities.
> >
> >
> > ----- Original Message ----- 
> > From: "Mili Aggarwal, Noida" <[EMAIL PROTECTED]>
> > To: <poi-user@jakarta.apache.org>
> > Sent: Wednesday, April 06, 2005 9:23 AM
> > Subject: Out of Memory Error
> >
> >
> > > Hey I am getting an out of memory error after the 
> following execution:
> > >  I have a Java program that creates an Excel Workbook 
> having 2 sheets
> > using
> > > POI. The total number of Styles being used in both the 
> sheets is 8.The
> > > problem that I am facing is after generating the Excel 
> for about 140
> > > workbook it gives an Out OF Memory Error and the program 
> crashes. But
> when
> > I
> > > re execute the program with the -Xmx18m i.e. I increase 
> the heap size,
> it
> > > runs perfectly fine. But the problem is, is there no 
> other alternative
> to
> > > reduce the amount of emery used by POI to generate Excel? I am
> explicitly
> > > calling Rutime.gc() to collect garbage but to no avail. Any ideas?
> > >
> > >
> > > Warm Regards,
> > > Mili Aggarwal
> > > HCL TECHNOLOGIES LTD.
> > > Noida, India.
> > > Email: [EMAIL PROTECTED]
> > >
> >
> > 
> --------------------------------------------------------------
> ------------
> > --
> >
> > 
> -----------------------------DISCLAIMER-----------------------
> ------------
> > --
> >
> > 
> --------------------------------------------------------------
> ------------
> > --
> > > --------
> > >
> > > This message and any attachment contained here are 
> information that is
> > > confidential, proprietary to HCL Technologies and its customers.
> Contents
> > > may be privileged or otherwise protected by law. The 
> information is
> solely
> > > intended for the individual or the entity it is addressed 
> to. If you are
> > not
> > > the intended recipient of this message, you are not 
> authorized to read,
> > > forward, print, retain, copy or disseminate this message 
> or any part of
> > it.
> > > If you have received this e-mail in error, please notify 
> the sender
> > > immediately by return e-mail and delete it from your computer.
> > >
> > >
> > >
> > >
> > >
> > >
> > > Disclaimer:
> > >
> > > This message and any attachment(s) contained here are 
> information that
> is
> > > confidential,proprietary to HCL Technologies and its customers,
> privileged
> > > or otherwise protected by law.The information is solely 
> intended for the
> > > individual or the entity it is addressed to. If you are 
> not the intended
> > > recipient of this message, you are not authorized to 
> read, forward,
> > > print,retain, copy or disseminate this message or any 
> part of it. If you
> > > have received this e-mail in error, please notify the 
> sender immediately
> > by
> > > return e-mail and delete it from your computer.
> > >
> > >
> > >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> >
> >
> > Disclaimer:
> >
> > This message and any attachment(s) contained here are 
> information that is
> > confidential,proprietary to HCL Technologies and its 
> customers, privileged
> > or otherwise protected by law.The information is solely 
> intended for the
> > individual or the entity it is addressed to. If you are not 
> the intended
> > recipient of this message, you are not authorized to read, forward,
> > print,retain, copy or disseminate this message or any part 
> of it. If you
> > have received this e-mail in error, please notify the 
> sender immediately
> by
> > return e-mail and delete it from your computer.
> >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> 
> 
> Disclaimer: 
> 
> This message and any attachment(s) contained here are 
> information that is
> confidential,proprietary to HCL Technologies and its 
> customers, privileged
> or otherwise protected by law.The information is solely 
> intended for the
> individual or the entity it is addressed to. If you are not 
> the intended
> recipient of this message, you are not authorized to read, forward,
> print,retain, copy or disseminate this message or any part of 
> it. If you
> have received this e-mail in error, please notify the sender 
> immediately by
> return e-mail and delete it from your computer.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> 


-----------------------------------------------------------------
ATTENTION:
The information in this electronic mail message is private and
confidential, and only intended for the addressee. Should you
receive this message by mistake, you are hereby notified that
any disclosure, reproduction, distribution or use of this
message is strictly prohibited. Please inform the sender by
reply transmission and delete the message without copying or
opening it.

Messages and attachments are scanned for all viruses known.
If this message contains password-protected attachments, the
files have NOT been scanned for viruses by the ING mail domain.
Always scan attachments before opening them.
-----------------------------------------------------------------

Reply via email to