Finding out how much file system memory is free

  • Thread starter Thread starter Jon Skeet [C# MVP]
  • Start date Start date
J

Jon Skeet [C# MVP]

In order to optimise a file caching strategy, I need to find out two
things:

1) How much non-volatile storage space is available (and where)
2) How much volatile storage space is available

I know how to find out how what the division between volatile storage
space and "working memory" is, and how to find out how much working
memory is being used, but I can't find the free volatile storage space.
Any clues?
 
First, I have to point out that the ratio can change dynamically. Having
said that, I expect that GetDiskFreeSpaceEx should do the trick.
And invoking in on a \<Storage Card directory, should give you the available
space there. To enumerate storage cards use
FindFirstFlashCard/FindNextFlashCard
 
The only case I can think of where that won't work is if there is on-board
(not storage card), flash memory mounted as a filesystem.
FindFirstFlashCard doesn't usually find those. I don't know of a better
way; you just have to be aware of it.

Paul T.

Alex Feinman said:
First, I have to point out that the ratio can change dynamically. Having
said that, I expect that GetDiskFreeSpaceEx should do the trick.
And invoking in on a \<Storage Card directory, should give you the
available space there. To enumerate storage cards use
FindFirstFlashCard/FindNextFlashCard
 
<"Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT
com> said:
The only case I can think of where that won't work is if there is on-board
(not storage card), flash memory mounted as a filesystem.
FindFirstFlashCard doesn't usually find those. I don't know of a better
way; you just have to be aware of it.

Thanks to both you and Alex - that should be fine.
 
Back
Top