[melange] Static initialization order fiasco



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/12/2012 at 18:56, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:    
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi fellow developers,

    I have bound the _melange_ memory allocation functions to a custom memory manager initialized only after the program have reached WinMain().

    In Release mode only, it seems that _melange_ use some kinf of CRT instructions to init the inner structure _melange_::InitStrings, whose constructor calls _melange_::InitStrings::InitStrings().

    It leads to two calls to _melange_::MemAlloc(VLONG), each one trying to allocate 131072 bytes before I even get the chance to execute a line of my code.

    I've found a workaround to prevent my allocator for crashing but it's not efficient nor elegant.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/12/2012 at 06:37, xxxxxxxx wrote:

    Hi,

    we've changed the InitStrings() to use only static memory so there should be no more memory allocation before your memory management is initialized.
    Please check with the next upcoming Melange version (I guess it will be released around the second week of january 2013).

    Thank you for pointing out this issue!
    Cheers,
    Jens



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/12/2012 at 14:09, xxxxxxxx wrote:

    Thank you for your quick answer. I look forward to the next released build !



  • On 14/01/2013 at 11:53, xxxxxxxx wrote:

    Hi,

    the new Melange v5.1 version (#70290) is available for download now:
    http://www.maxon.net/support/developer-support.html

    Cheers,
    Jens

    changes since #68456:
    - IDs for XmbSubSurface shader added
    - fix when custom memory management is used (InitStrings() do not allocate memory anymore)
    - print out polygon selection data (commandline tool)
    - fix mem leak in GeExecute (StartRenderServer) (OSX only)
    - small fixes in renderconnection example
    - fix when parsing argument list of GeExecute() (OSX only)
    - fix GeGetTimer() (OSX only)
    - win libs vs2012 update 1 compiled



  • On 21/01/2013 at 14:42, xxxxxxxx wrote:

    Whoo that was fast, good work ! I'll use this new build in no time !

    By the way, the Developer support page where the Melange library can be downloaded still states that the current build is the #68456  one


Log in to reply