[PATCH 1/5] d3dx9_36: Implement D3DXFileCreate. (try 3)

Rico Schüller kgbricola at web.de
Wed Oct 24 12:07:32 CDT 2012


On 24.10.2012 18:18, Dmitry Timoshkov wrote:
> Rico Schüller <kgbricola at web.de> wrote:
>
>>>>>> +    if (!object)
>>>>>> +    {
>>>>>> +        ERR("Out of memory\n");
>>>>>> +        return E_OUTOFMEMORY;
>>>>>> +    }
>>>>>
>>>>> The ERR() is useless here, just return E_OUTOFMEMORY in such situations.
>>>>>
>>>>>
>>>>>
>>>> It's done this way in many places in wine.
>>>
>>> Then that other places need to be fixed as well. Printing an ERR() on memory
>>> allocation errors is not helpful.
>>>
>> In which cases do you use ERR? I thought it is used, when there are
>> system errors. And I think ERR is fine for out of memory, because the
>> system is not able to hand out the needed memory. Just do a git grep.
>> There are ~400 usages for ERR and out of memory... What's your
>> suggestion how to do that with the "Out of memory"?
>
> A much more illustrative thing that happens after an out of memory
> condition is a crash followed by a backtrace (if the caller does not
> handle it gracefully), printing an ERR() is completely useless in that
> case, and provides no useful information.
>
Well the app may initialize some resources (some of them fail with out 
of memory) and run half an hour. If it accesses the invalid pointer it 
crashes. Do you see the problem from the backtrace? The real problem 
happened half an hour ago and the err message doesn't hurt anyone, it 
just shows the problem as early as possible, which I think is better 
than to relay on a eventually crashing app at some point. The err 
doesn't spam the console, since it only happens when there is a problem.

Cheers
Rico



More information about the wine-devel mailing list