Writing to file when out of memory

Discussion in 'Plugin Development' started by thechrisanator, Dec 15, 2019.

Thread Status:
Not open for further replies.
  1. Offline

    thechrisanator

    I got a recent report of writing to a file when the computer is out of memory on the hard drive, and apparently the file was trying to be written to, but since it ran out of space, it just stopped writing to the file and left it blank.
    Is there any way to detect that? Does Java know if it runs into that?
     
  2. I don't know if there is a nice proper way, but the easiest I can think of is keeping track of how many bytes you wrote to the file and afterwards comparing the new size of the file with the number of bytes you wrote to it. If they are not equal, something must have gone wrong.
     
  3. Offline

    KarimAKL

    @thechrisanator I'm not exactly sure what you mean but, maybe this helps with getting the information you want?
     
  4. Offline

    thechrisanator

    Thanks for the replies. knokko, your reply may work, but seems like a lot of hassle. Might be the only way though.
    Basically, to try to rephrase my issue: A user reported that his data failed to save (thus losing a bunch of items) due to his hard drive being full.
    Is this just an issue that is out of my control? How am I supposed to save if the hard drive is full?
    He says that his save file was completely wiped due to this failed writing to the file.
     
  5. Offline

    KarimAKL

    @thechrisanator Why would the file be saving on their computer? It should be saving on the server so, it shouldn't have anything to do with the user.
     
  6. @KarimAKL The server is also a computer, which also has finite disk space (and there is probably some special per-server limit when using a host).
     
  7. Offline

    KarimAKL

    @knokko I still don't get what the server's computer and the player's computer have to do with eachother when it comes to disk space.
     
  8. @KarimAKL I think he meant the servers disk space instead of the players disk space. (And for test servers, the servers disk space is usually the only players disk space.)
     
  9. Offline

    KarimAKL

    @knokko That would make a lot more sense.

    @thechrisanator I'd probably check if there's any way to reduce the amount of data saved, as well as look at getting more disk space.
     
Thread Status:
Not open for further replies.

Share This Page