[Bf-committers] Some words about a strange thing named

Yomgui yomgui1 at gmail.com
Fri Nov 25 10:02:04 CET 2005


Hi Ton,

> Hi,
>
> All our current platforms crash Blender nicely on referencing a NULL
> pointer. I've not heard of OS's crashing for it. How Morphos does this
> I don't know...

"crash Blender nicely"... !? How a crash can be nice? ;-)

In current shape of MorphOS, it doesn't protect memory of an
application from another one.
So crashes may force you to reboot. But it's not the matter here.

It's not the first time that I seen some developpers saying "I never
check functions return... It tooks me too many time...". I totally
disagree that.
If we take just just few minutes to think about our design before
coding, and respect some basics rules (handling the NULL case of a
malloc are written in all good C books),
we can produce a strong and stable application. Even on yours
platforms (I mean Win/Mac/Linux here) any crashes lose your last data,
and auto-save features is just a workaround to resolve an easy
resolvable issue (but it's the tree that hidden the wood...).
In example: render engine crash just because you haven't suffisent
memory (it's really easy to do that ;-)) and you lose your last data.
I know, you'll say that users have just to save their works before a
rendering, but why to oblige them to some actions due to the code
weaknesses?

> I do realize that every routine in Blender should not fail on mallocs,
> but this is very painful coding for more complex areas (like render
> system). Typically, a system already has been swapped totally unusable
> before it starts returning NULLs, and a user already killed Blender. :)

I'm sure that it's not so painful as you say ;-)
But time is playing against us... the complexity of blender grows up
day after day, and one day it will not possible to turn back.

Even all respect I've got for you, I'm very disappointed by your comment.
I'm closer considering the portability of an open-sources application.
I can't let that.
But, I'll continue to search and develop solutions to secure the Blender code...
...I don't like user reports about crashes ;-)

Regards,
GR

> -Ton-
>
> On 24 Nov, 2005, at 9:44, Yomgui wrote:
>
>> Hi to all Blender developers,
>>
>> During my port of Blender on MorphOS and a try to bring to blender a
>> nice OS abstraction layer, I've seen some ugly code lines. So, I want
>> to advise all developers about that:
>>
>> MEM_mallocN/MEM_callocN and all derivated, declared in
>> intern/guardedalloc/mallocn.c, may return a null pointer (0) in some
>> cases (i.e. not enough memory), but...
>>
>> ... I seen too many files that use these functions without any
>> checking of the return value!
>>
>> The result of the usage of a null pointer is totally platform
>> dependent, and may cause the whole crash of the platform in the worst
>> case (I think that there is no best case ;-))
>>
>> So please, can you check your code and design it to handle this case?
>> It's very important to have a good and clean software.
>>
>> Many thanks for your attention,
>> Guillaume R.


More information about the Bf-committers mailing list