Replies: 1 comment 4 replies
-
This is good observation. This is how kernel manages resources, in this cases files. Kernel will not remove resource that you have open handle to, this would cause wrong application behavior and most likely crashes. This is not related to mpv and there are better publications/books to read about the resource management and file systems. But I can give you high level overview. Mostly from UNIX point of view.
Those things that you see in explorer are just pointers to where the data is. Or in fact where the metadata about the file is (inode). You can have multiple "paths" (hard links) pointing to single resource. inode is index of a "bucket" that keeps information about the file, like mode, size, links count and blocks building the file. Now if you delete a file, inode will be deleted only if links count is 0 and there are no open file descriptors to this file. And once inode is gone, the blocks will be available to be reused. In short when mpv is reading file, you can remove the file, but in reality inode will still be alive until you close the mpv.
No, mpv can cache some of the data in memory, but it's not a full copy and by default it is only small portion of a file, for local files it is 1s only.
mpv doesn't do that, kernel does. But like said before, it doesn't mark the blocks as free until all references to this file are closed. I'm bad at explaining things, I googled, and this may be interesting for you on this topic of filesystem basics. This was very simplified, there are many nuisances how it works, depending on the kernel, filesystem and so on. For example NT kernel (Windows) doesn't allow removing files that are in use at all, while Linux will happily unlink() your file, but internally keep it alive as long as needed. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For context, I don't have a background in computer related subjects, but I'm interested in exploring tech. So I might not understand extremely technical answers.
I was playing a video (~15GB), and without closing the player or moving to a new video, I deleted the file. Returned to the player, and got curious if it would still access the file in its entirety, which to my surprise it did.
So basically:
My guesses are:
I'm sorry if this isn't the place for this, but I found this quite interesting and had to ask.
Beta Was this translation helpful? Give feedback.
All reactions