Re: DocumentLoader memory leaking on cleanup

Mathias Bauer <[email protected]>
Newsgroups gmane.comp.openoffice.devel.api
Message-ID <[email protected]>
On 10/25/2010 07:10 PM, Chris Rider wrote:
> We are using DocumentLoader to manage the opening of PowerPoint files,
> and have recently discovered what appears to be a memory leak.
>
> As a quick background, these are self-advancing presentations, created
> using Microsoft by the end-user, who then uses our product (CentOS
> based) to display the files.
>
> When the cleanup routine is called, it appears to do its thing, but a
> bit of time later, the machine is almost frozen from all of its memory
> being used up... and after taking a look at the processes on the
> machine, we tracked it back to this.
>
> Below is from our log file...
> It looks like it reaches the end of the slideshow (event
> OnEndPresentation) and fires the Cleanup routine... but is it working
> past that point? Appears to not be.
>
> Are there any known issues with this sort of thing? Anyone else seeing
> this?
> Thanks!
> Chris
>
> 1288025660 : pid: 6935 - Acquiring lock...
> 1288025660 : pid: 6935 - Lock acquired!
> 1288025660 : pid: 6935 - Connected successfully to the office
> 1288025660 : pid: 6935 - XComponentloader successfully instantiated
> 1288025660 : pid: 6935 -
> argv[1]=/home/silentm/public_html/multimedia/951918099.Clarian.ppt
> 1288025660 : pid: 6935 - Document:
> file:///home/silentm/public_html/multimedia/951918099.Clarian.ppt
> 1288025661 : pid: 6935 - Starting Presentation...
> 1288025661 : pid: 6935 - Presentation Started!
> 1288025661 : pid: 6935 - Frame:
> 1288025661 : pid: 6935 - Frame:
> 1288025661 : pid: 6935 - Frame:
> 1288025661 : pid: 6935 - Releasing lock...
> 1288025661 : pid: 6935 - Lock released!
> 1288025661 : pid: 6935 - Wait for end!
> 1288025661 : pid: 6935 - Event : OnUnfocus received
> 1288025661 : pid: 6935 - Event : OnStartPresentation received
> 1288025661 : pid: 6935 - Event : OnFocus received
> 1288025661 : pid: 6935 - Event : OnLoad received
> 1288025662 : pid: 6935 - Event : OnEndPresentation received
> 1288025662 : pid: 6935 - Ending!
> 1288025662 : pid: 6935 - Event : OnViewClosed received
> 1288025662 : pid: 6935 - Event : OnUnfocus received
> 1288025664 : pid: 6935 - Cleanup
> 1288025664 : pid: 6935 - Cleanup - close - dispose

I don't know how you created your logs, but at least in this log I don't 
see traces of the document being closed (Event OnClose, disposing etc.). 
But maybe that's part of the last line.

Besides that, the document being closed does not mean that it is removed 
from memory. It's possible that it is still referenced somewhere and so 
the object is not destroyed. I think that eating up the memory 
completely - as you described it - would require thousands of such 
dangling references, but you never know.

So look for references to documents (models) in your code. In case your 
application is implemented in Java, don't rely on the garbage collection 
doing the work for you, it might kick in just too late.

Regards,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
Please don't reply to "[email protected]".
I use it for the OOo lists and only rarely read other mails sent to it.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.