www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Estimating free system resource at runtime

reply seany <seany uni-bonn.de> writes:
Hi

I have a system that has to deal with 30+GB files. They can't be 
loaded to the amount of memory I have.

So my idea was to create a way to estimate available system RAM, 
and read a chunk from file which is 1/10 of size of available 
RAM, and process it as far as i can. If the read chunk is too 
small to meaningfully process, then i wait until resources are 
free.  If i read a chunk with some trailing things at the end 
that cant be processed, then i trim it, and reset the seek 
position.

However, i cant find anything on google to tell me how to 
estimate system resource using D. for C++ and windowes, i could 
find some API-s

Can e do this in D?
Aug 20 2017
parent Anonymouse <asdf asdf.net> writes:
On Sunday, 20 August 2017 at 15:49:09 UTC, seany wrote:
 However, i cant find anything on google to tell me how to 
 estimate system resource using D. for C++ and windowes, i could 
 find some API-s

 Can e do this in D?
You can just use those C APIs. I believe the GC does, unless I'm reading it wrong. https://github.com/dlang/druntime/blob/acd2c55095ec039be2a9c20a8891ee40e4a393c3/src/gc/os.d#L173-L175 https://github.com/dlang/druntime/blob/acd2c55095ec039be2a9c20a8891ee40e4a393c3/src/core/sys/windows/winbase.d#L1383-L1392
Aug 20 2017