void abc () {
FileInputStream fin = new FileInputStream (strPathName);
}
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
This. . . No ah
Reply:
General use
FileInputStream fin = new FileInputStream (strPathName);
When the final should not
fin.close (); it?
Reply:
FileInputStream fin = new FileInputStream (strPathName);
In accordance with java argument is local object, are automatically maintained garbage collector when no object reference is automatically released
Reply:
Certainly, ah, this does not automatically close the JVM.
Reply:
Look at the topic of discussion
Reply:
Did not see it that way

Reply:
This is not a garbage collection mechanism with the JAVA relationship ah? I remember when I heard that if nobody is quoted, JAVA memory recovery after a while it will let go of.
Reply:
Well, I only rookie wuhuakejiang
Reply:
2 Please be responsible for your words and deeds, and People's Republic of China to comply with relevant laws and regulations, respect the moral line.
Reply:
Otherwise, you must close the object you know recycling is a null reference was recovered
This reference was recovered
emptyBut open stream must be manually turned on or close
When we create an IO stream object in the program when the same system also creates
Something called a stream, in this case, the actual computer memory generates two things, one way
javaExamples of object classes in sequence, one is some sort of resource system itself, but can only manage garbage collector java program
Examples of object classes, and no way to manage the resources generated by the system, so the program needs to call the close method to pass
Knowledge system to release its own resources generated.
Reply:
java This is very bad, no destructor, as this recycling must display the call, but also a variety of abnormal fear of interference. Encapsulated in C + + destructor on the line
Reply:
File handle is not closed. You run thousands of times, and then the number of handles Task Manager process facie know.
Reply:
. . Did not see the Android, but is the same.
Reply:

Reply:
Not leak. Lead to memory leaks is not recyclable, and can only say that the file is not released here permissions, but the object is to be recovered, the file permissions again been released.
Reply:
Yes, I just found out you said it should be right.
/ / Begin - I
in online searchpublic void close ()
throws IOException
Closes this input stream and releases any system resources associated with the stream.
The close method of InputStream does nothing.
The garbage collector only be useful for the class instance object, and resource consumption for the system to produce no effect
/ / End - I
in online searchThis point of view there is indeed a memory leak, but the memory leak is not in the class instance object, but the system resources.
But now we have a new problem that just gives way online to understand on an emotional, rather than the actual verification of the results. . . .
Who way to verify the above code in ubuntu does have a memory leak above it?
If so, invitations out.
LZ better if I study will quote the words out. . . .
Reply:
If you call the method, the program has its own end (end of the process), then he will go.
Reply:
The current situation is that the program does not end. . . .
In your view, is also a memory leak. .
Reply:
Boring

Reply:

Reply:
Did not see it.
Reply:
Frequently used, generally eventually close off
Reply:
haohaohaohaohaohaohaohaohaohaohaohaohaohaohaohaohaohaohaohao
Reply:
This depends on how the definition of a memory leak. Support the "yes" and "no", and are justified.
Reply:
to see how the design of this class.
Reply:
Have memory leaks, the flow has been in existence, the object may be recovered, but the channel is has been associated with the file.
Reply:
Reply:
Will be memory leaks, give you an example, you open a drainage pipe, and then tap recovered by the administrator, but the pipe is still open (stream objects like faucet, document flow like water pipes)
Reply:
Good profound way. . .
Reply:
Like this, new 1000 times, check your memory, you will understand.
Reply:
Looks like she will. Are generally close to the end
Reply:
Reply:
Will be closed at any time
Reply:
Reply:
Reply:
In finally closed in
Reply:

Reply:
... Hao
Reply:
Very interesting topic. . Learn. . Incidentally Bangding. .

Reply:
Amount, rookie do not understand this, but I know the writing close.
Reply:
I have come to learn
Reply:
Very interesting topic. . Learn. . Incidentally Bangding. . Amount, rookie do not understand this, but I know the writing close
Reply:
Do not have to spend too much too buckle detail, develop good habits to develop is always good.
Reply:
Reply:
Reply:
Resource handle must be manually released
Reply:
Can not see ah ~
Reply:
Look and learn under

Reply:
In Java, when no object reference point was originally assigned to the memory of an object, the memory becomes garbage. JVM is a system-level threads will automatically release the memory block.
void abc () {
FileInputStream fin = new FileInputStream (strPathName);
}
fin for new FileInputStream (strPathName) memory block references, note fin is local, the fin out of scope, fin invalid, that new FileInputStream (strPathName) memory blocks no object reference it, then it will automatically release jvm .
So for java concerned, not a memory leak.
But for c + +, it will certainly be compromised.
Reply:
Oh, I was a rookie did not see it
No comments:
Post a Comment