[ http://issues.apache.org/jira/browse/LUCENE-623?page=all ]

Nadav Har'El updated LUCENE-623:
--------------------------------

    Attachment: ramdirectory.diff

I propose a trivial patch, which does two very simple things:

1. RAMDirectory.close(), instead of being a no-op, sets files=null. This allows 
the garbage collector to collect all the memory that was used for this 
RAMDirectory (this is the best we can do in Java).

2. Make the documentation more explicit, from "Closes the store to future 
operations." to "Closes the store to future operations, releasing associated 
memory."

Note that now, after a close(), any operations on the RAMDirectory will likely 
result in a NullPointerException. I don't think this matters, as the 
documentation clearly says that after a close() you're not allowed to operate 
on this object.


> RAMDirectory.close() should have a comment about not releasing any resources
> ----------------------------------------------------------------------------
>
>          Key: LUCENE-623
>          URL: http://issues.apache.org/jira/browse/LUCENE-623
>      Project: Lucene - Java
>         Type: Improvement

>   Components: Store
>     Versions: 1.9
>     Reporter: Heng Mei
>     Priority: Minor
>  Attachments: ramdirectory.diff
>
> I wrongly assumed that calling RAMDirectory.close() would free up the memory 
> occupied by the RAMDirectory.
> It might be helpful to add a javadoc comment that warns users that 
> RAMDirectory.close() is a no-op, since it might be a common assumption that 
> close() would release resources.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to