wxWidgets and memory allocation failures.

Jurko Gospodnetić jurko_for_boost at mail.inet.hr
Mon Apr 9 12:13:06 PDT 2007


   Hi.

>>   1. terminating the application
>>   2. returning an error code (either global/thread-local variable, 
>> return value or an error-code parameter).
>>   3. throwing an exception.
> ..
>>   And all you are left with is option 1 (with possibly an application 
>> defined function call as described above).
> 
> 
> I don't see it so pessimisticly.
> One can write user defined new operators,
> like I did in aUCBLogo.


   I was not being pessimistic. :-))) Sorry if I was not clear enough. I 
thought I 'added support' for your solution with:

>>   Before this handling wxWidgets could call an application defined
>> function, possibly allowing the application callback to free up
>> some memory and have wxWidgets retry the previously failed memory
>> allocation instead of simply failing.


   Just wanted to say I saw your suggested solution and liked it. :-) I 
actually played around with it before but I do not really see it as 'the 
one true solution'. In out-of-memory situations most often there really 
is nothing much to be done except log and bail out and robust 
applications need to be written so abrupt terminations (power failure?) 
do not cause them to be left in a corrupt state anyway.

   My wish would be for wxWidgets to add support support for this so 
that applications may implement such a strategy but still - not force it 
upon them.


   Best regards,
     Jurko Gospodnetić





More information about the wx-users mailing list