|
-
November 26th, 2007, 08:46 PM
#1
will this lead to memory leak? it shouldn't, should it?
in my code i have something like
Code:
FileStream fs = new Filestream("file.txt", FileMode.Open);
processFile(fs);
|
|
|
processFile(Filestream strm) {
...do something
strm.close();
}
If I am closing the stream in the function processFile(), would that actually cause any memory leak? I mean strm and fs all point to the same objects..
so techincally if i call strm.close(), the filestream itself would be closed, and strm will be destroyed on function call return since it is a local variable. And since fs refers to a closed stream, it should be picked up by the garbage collector right?
please let me know.
thnx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|