开发者

C# - Reserve disc memory(storage)for app

I'm making an app that needs 500 MB of free disc space to run. How to make sure that that kind of disk space is always reserved fo开发者_高级运维r my app (even when app is turned of).

EOG


How about creating a 500MB "empty" file and minimize the size of the file when you need diskspace?


When you install you application you can create a 500 MB file and use that whenever your application is running. However, it seems somewhat wasteful.

Another option is to let your application fail gracefully if it cannot create the files it need. Then you wouldn't have to reserve space and no space would be wasted when your application isn't running.


As mentioned above, your best option is to create a file of the size that you need. I'd like to add to this: depending on your task you can use this size as a virtual disk for storing your data (the one you need to be stored on the real disk). The benefit is that the data in container can be persistent and that you don't need to resize the file to free space for your needs - you just use the file itself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜