But this have to be defined during build time of SpiderMonkey library. Or am I wrong and this can be used also during linking? (in application using SpiderMonkey I can define/not-define JS_USE_CUSTOM_ALLOCATOR and decide what allocator functions to use?)
With weak symbols it would be possible to have one library. By default applications using it would use standard Mozilla allocator. But application developers could provide object file with for example definition of js_malloc during application compile time and change the behaviour).
A benefit of this is that applications which want to use custom allocator do not have to compile SpiderMonkey on their own and bundle it.