Allocation failures

Jardík via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 14 04:10:34 PST 2016


When I was interested in D some time ago, I believe GC was 
aborting the application on allocation failures. Is that still 
the case today? I am looking into using D for my new application, 
but I need some guarantees that I can at least save some critical 
data, when such thing happens, perhaps freeing some stuff that is 
not really needed for the saving part (e.g. I could destroy GUI, 
free all saved unmodified documents and after that proceed to 
save unsaved changes to temporary file of some kind (even 
unbuffered as i may not have enough memory for a buffer). This is 
essential for me, that I am able to do it, that there is a change 
to handle such situation. The application will run on a system 
with over-commit disabled, so that (C) malloc can correctly 
report failures. Is it currently possible? Will it be possible in 
a near future?

I could use malloc directly for such data and check its return 
values, but it won't save me when there would be enough memory 
and while after that GC will fail on something else and crash my 
application.

I was also thinking about using rust for it, but for this very 
same reason I can't (rust aborts() almost everywhere on 
allocation failures).


More information about the Digitalmars-d mailing list