Let's discuss this on the JIRA. I think Tsuyoshi OZAWA's solution is good.
Colin
On Thu, Aug 21, 2014 at 7:08 AM, Ted Yu wrote:
> bq. else there is a memory leak
>
> Moving call of close() would prevent the leak.
>
> bq. but then this code snippet could be java and can be messy
>
> The code is
bq. else there is a memory leak
Moving call of close() would prevent the leak.
bq. but then this code snippet could be java and can be messy
The code is in Java.
Cheers
On Wed, Aug 20, 2014 at 10:00 PM, vlab wrote:
> Unless you need 'out' later, have this statement.
> FileWriter out(restartM
Unless you need 'out' later, have this statement.
FileWriter out(restartMeta);
then when exiting the try block, 'out' will go out of scope
i assume this FileWriter that is create is delete'd else where
(else there is a memory leak). {but then this code snippet could be
java and can be messy.}
Ted Yu created HDFS-6902:
Summary: FileWriter should be closed in finally block in
BlockReceiver#receiveBlock()
Key: HDFS-6902
URL: https://issues.apache.org/jira/browse/HDFS-6902
Project: Hadoop HDFS