lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <j...@apache.org>
Subject [jira] Updated: (LUCENE-2283) Possible Memory Leak in StoredFieldsWriter
Date Sun, 28 Feb 2010 19:52:05 GMT

     [ https://issues.apache.org/jira/browse/LUCENE-2283?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Michael McCandless updated LUCENE-2283:
---------------------------------------

    Attachment: LUCENE-2283.patch

New rev attached with some small improvements:

  * Changed RAMOutputStream.reset to set currentBuffer to null (frees up that 1 buffer), and
call that instead of close.

  * Removed the separate PerDoc.recycle -- now I just do the recycle in the existing PerDoc.reset
method

Also, this patch changes the RAM accounting to count buffers allocated not bytes written to
the file.  This is a good change, and I think may explain the too-much-memory-allocated problem
you saw.  Ie if you write tiny docs, Lucene was thinking they consumed tiny memory (not the
1024 bytes that the 1 buffer uses) and thus was undercounting.  When mixed in with massive
docs this can cause way too much RAM to be allocated.

Have you been able to test if this patch resolves Lucene's part of the mem growth you were
seeing?

> Possible Memory Leak in StoredFieldsWriter
> ------------------------------------------
>
>                 Key: LUCENE-2283
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2283
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.4.1
>            Reporter: Tim Smith
>            Assignee: Michael McCandless
>             Fix For: 3.1
>
>         Attachments: LUCENE-2283.patch, LUCENE-2283.patch, LUCENE-2283.patch
>
>
> StoredFieldsWriter creates a pool of PerDoc instances
> this pool will grow but never be reclaimed by any mechanism
> furthermore, each PerDoc instance contains a RAMFile.
> this RAMFile will also never be truncated (and will only ever grow) (as far as i can
tell)
> When feeding documents with large number of stored fields (or one large dominating stored
field) this can result in memory being consumed in the RAMFile but never reclaimed. Eventually,
each pooled PerDoc could grow very large, even if large documents are rare.
> Seems like there should be some attempt to reclaim memory from the PerDoc[] instance
pool (or otherwise limit the size of RAMFiles that are cached) etc

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message