R16 memory leaks [SOLVED]



  • On 18/09/2014 at 08:52, xxxxxxxx wrote:

    Hi Wilfried,

    Thanks for the response.  I do not think I have modified the source files in any way before compiling in xcode.  I have my mac system set up with two installations.  One for development and one for work.  When I install C4D software, I copy the entire work installation to a dev directory.  The examples folder is never modified in the work directory.

    I installed R16 from an ISO downloaded on 09/12/14 from MAXON.  I then ran the online updater immediately after install. The about screen reports R16.021 (BUILD RB111778).

    Would it be possible for me to send you a zip of the examples directory from my unmodified work directory for your review? Or do you think that I have a problem with my xcode install?

    Thanks for you help,

    Joe Buck



  • On 18/09/2014 at 09:35, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    [...] Would it be possible for me to send you a zip of the examples directory from my unmodified work directory for your review? Or do you think that I have a problem with my xcode install?</span></span>
    <span style=": rgb248, 248, 252;"><span style="line-height: 16.7999992370605px;"></span></span>
    <span style=": rgb248, 248, 252;"><span style="line-height: 16.7999992370605px;">Thanks for you help,</span></span>
    <span style=": rgb248, 248, 252;"><span style="line-height: 16.7999992370605px;"></span></span>
    <span style=": rgb248, 248, 252;"><span style="line-height: 16.7999992370605px;">Joe Buck</span></span>

    Easier solution - use MD5 to check:

    tar c /Applications/MAXON/16.021_RB111778/plugins/examples/cinema4dsdk | md5

    (you've to adapt your path of course) should result in: ffc43a7788ca84952b7ea96efe762b05

    If it is on your system too, check if you've installed other 3rd party plugins or scripts to make sure the sdk plugin you've compiled is really causing this leak.

    Best regards,

    Wilfried



  • On 18/09/2014 at 13:27, xxxxxxxx wrote:

    Hi Wilfried,

    I tried the test and the sums do not match.  This might be misleading.  When I run the tar | md5 command from different locations in the OSX file system, I get different md5 sums.  This is also true if i run the commands on Windows using cygwin.

    If a actually create a tar file and copy it to a different location then check sums on both files, the checksums are identical to each other, but do not match the checksum you have provided.

    I also:
    uninstalled and re-installed xcode 5.1.1.(drag app to trash, re-download from AppStore)
    deleted the dev folders containing R16.
    copied clean install back to dev folders.
    re-built R16 sdk project only adding C4D executable and -g_alloc=debug to debug settings.

    Still have the memory leak.

    Please let me know if there is anything else you might recommend to troubleshoot this issue.

    Thanks again for your time and help,

    Joe Buck



  • On 18/09/2014 at 14:03, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Unfortunately there was code enabled in the leak detection that creates an exception instead of the intended output (which is useful for us when debugging, but not for you as 3rd party programmer). This exception needs symbol files for debugging that you don't have and can't download.

    Thanx for reporting it - we'll fix that asap.

    Was this code also enabled in R15?

    @joebuck

    Did you do anything but starting and closing Cinema 4D? Doing just that with a clean installation of
    Cinema 4D R16.021 and compiled example project does not yield a memory leak here.



  • On 18/09/2014 at 14:39, xxxxxxxx wrote:

    Hi Niklas,

    Originally posted by xxxxxxxx

    Did you do anything but starting and closing Cinema 4D?

    No.  I only compiled and stopped the program.  I will try a complete re-install R16 next and let you know what happens.

    Thank you,

    Joe Buck



  • On 19/09/2014 at 00:04, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Originally posted by xxxxxxxx

    Unfortunately there was code enabled in the leak detection that creates an exception instead of the intended output (which is useful for us when debugging, but not for you as 3rd party programmer). This exception needs symbol files for debugging that you don't have and can't download.

    Thanx for reporting it - we'll fix that asap.

    Was this code also enabled in R15? [...]

    No.

    Best regards,

    Wilfried



  • On 19/09/2014 at 00:22, xxxxxxxx wrote:

    Hi Wilfried and Niklas,

    I just did a complete clean re-install of OS X Mavericks, Xcode and Cinema 4D with the same results.  To be clear, I erased the startup drive with Disk Utility so the Mavericks installer did not try to save any of my data, and then installed the operating system(plus updates), Xcode and C4D R16(plus updates).

    Here is the console output:

    Application start      : 09/19/14 at 01:40:28
    Executable             : 64 Bit
    Version / Build        : 16.021 / RB111778
    Debugger               : available
    Memory model           : debug
    Startup path           : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16
    Application path       : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/CINEMA 4D.app
    Application executable : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/CINEMA 4D.app/Contents/MacOS/CINEMA 4D
    Resource path          : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/resource
    Module path(s)         : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules
    Temporary path         : file:///var/folders/f5/79h1lxlj76d060mwqmdrh1_r0000gn/T
    Prefs path             : file:///Users/joebuck/Library/Preferences/MAXON/CINEMA 4D R16_7B5EB4B8
    Global Prefs path      : file:///Users/joebuck/Library/Preferences/MAXON
    OS version             : OS X 10.9.5
    Processor              : 8x Intel Core i7-4850HQ CPU 
    Computer name          : Jody's MacBook Pro
    Thread Count           : 8
    Cpu Speed (MHz)        : 2300.000
    Application Type       : Modular
    Command line arguments : "-g_alloc=debug" "-NSDocumentRevisionsDebugMode" "YES" 
      
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/c4dplugin.xlib with module(s) net.maxon.c4d.c4dplugin
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/crashhandler.module.xlib with module(s) net.maxon.crashhandler
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/crypt.module.xlib with module(s) net.maxon.crypt
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/image.module.xlib with module(s) net.maxon.image
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/mesh.module.xlib with module(s) net.maxon.mesh
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/misc.module.xlib with module(s) net.maxon.misc
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/network.module.xlib with module(s) net.maxon.network
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/triangulation.module.xlib with module(s) net.maxon.triangulation
    2014-09-19 01:40:29.227 CINEMA 4D[1219:303] setPresentationOptions called with NSApplicationPresentationFullScreen when there is no visible fullscreen window; this call will be ignored.
      
    CrashHandler not installed
    Bonjour found: 522.92
    Memory Leaks Detected:
    /perforce_buildsystem_osx/c4d_mx_buildsystem_osx/release/16.0/frameworks/kernel.framework/source/implementation/xstring_impl.cpp (1094) : Memory leak of 15 bytes () at 0x1097920e0
    1 blocks not freed
    

    Perhaps I could send you the Xcode project I get from the install, or you could send me the Xcode project that produces no leaks?

    Please let me know if there is anything else I can do to help troubleshoot this problem.

    Thanks again for your time and help,

    Joe Buck



  • On 08/10/2014 at 09:49, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    [...]
    Please let me know if there is anything else I can do to help troubleshoot this problem.
    Thanks again for your time and help,
    Joe Buck

    Please check 16.027. It fixed the exception issue and gives you a good indication of the reason for your memory leak.

    Best regards,

    Wilfried



  • On 08/10/2014 at 11:45, xxxxxxxx wrote:

    Hi Wilfried,

    Thanks for staying on top of this for me! 
    Xcode is now reporting memory leaks for me in the R16 project.

    I created a memory leak in MouseInput SDK Liquid Painter.  Here is the output:

    Application start      : 10/08/14 at 12:40:38
    Executable             : 64 Bit
    Version / Build        : 16.027 / RB113727
    Debugger               : available
    Memory model           : debug
    Startup path           : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16
    Application path       : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/CINEMA 4D.app
    Application executable : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/CINEMA 4D.app/Contents/MacOS/CINEMA 4D
    Resource path          : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/resource
    Module path(s)         : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules
    Temporary path         : file:///var/folders/c2/txkqll0x6332gf7zzb8srnqr0000gn/T
    Prefs path             : file:///Users/joebuck/Library/Preferences/MAXON/CINEMA 4D R16_7B5EB4B8
    Global Prefs path      : file:///Users/joebuck/Library/Preferences/MAXON
    OS version             : OS X 10.9.4
    Processor              : 8x Intel Core i7-4850HQ CPU 
    Computer name          : Joe's MacBook Pro
    Thread Count           : 8
    Cpu Speed (MHz)        : 2300.000
    Application Type       : Modular
    Command line arguments : "-g_alloc=debug" "-NSDocumentRevisionsDebugMode" "YES" 
      
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/c4dplugin.xlib with module(s) net.maxon.c4d.c4dplugin
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/crashhandler.module.xlib with module(s) net.maxon.crashhandler
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/crypt.module.xlib with module(s) net.maxon.crypt
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/image.module.xlib with module(s) net.maxon.image
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/mesh.module.xlib with module(s) net.maxon.mesh
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/misc.module.xlib with module(s) net.maxon.misc
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/network.module.xlib with module(s) net.maxon.network
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/triangulation.module.xlib with module(s) net.maxon.triangulation
    2014-10-08 12:40:38.640 CINEMA 4D[1648:303] setPresentationOptions called with NSApplicationPresentationFullScreen when there is no visible fullscreen window; this call will be ignored.
      
    CrashHandler not installed
    Bonjour found: 522.92
    Memory Leaks Detected:
    /Users/joebuck/MAXON_dev/CINEMA 4D R16/plugins/examples/cinema4dsdk/source/tool/liquidtool.cpp (45) : 4 Memory leaks of 4 bytes (, first leak at 0x11fd67460)
    /perforce_buildsystem_osx/c4d_mx_buildsystem_osx/release/16.0/frameworks/kernel.framework/source/implementation/xstring_impl.cpp (1094) : Memory leak of 15 bytes () at 0x10ba870e0
    2 blocks not freed
    

    I am however still getting the same unexpected leak message:

    /perforce_buildsystem_osx/c4d_mx_buildsystem_osx/release/16.0/frameworks/kernel.framework/source/implementation/xstring_impl.cpp (1094) : Memory leak of 15 bytes () at 0x10ba870e0
    

    I do not understand this leak because I am a c++ amateur and I can not find the file on my system.  Do you know where this file is and what it is for?

    Also, this leak is persistent with or without the leak I created.

    I would also like to note that I have completely re-installed OSX, Xcode and C4D.  Nicklas also sent me his copy of the SDK project and I get the same results with that.

    The R15 memory leak detection works as expected on this system.

    For R15 I followed the instructions in the docs to set memory leak detection.  Perhaps I am missing an Xcode project setting somewhere for R16.  Do you know if the Xcode project set up for memory leak detection is different between R15 and R16?

    Again, I really appreciate your help.

    Thank you,

    Joe Buck



  • On 09/10/2014 at 07:55, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Hi Wilfried,
    Thanks for staying on top of this for me! [...]
    Memory Leaks Detected:

    /Users/joebuck/MAXON_dev/CINEMA 4D R16/plugins/examples/cinema4dsdk/source/tool/liquidtool.cpp (45) : 4 Memory leaks of 4 bytes (, first leak at 0x11fd67460)
    

    This is the important line as it points to the original problem - there 's a leak int the liquid painter example (and as the sample is from R9 or older, its there for quite some time) and this one - at least on my machine - can be triggered on OS X (only), if you open this example dialog and quit the app via the closer - if you use the "File -> Quit" menu it doesn't happen. If you close the document before closing or switch to a different tool it doesn't happen either...

    Originally posted by xxxxxxxx

    /perforce_buildsystem_osx/c4d_mx_buildsystem_osx/release/16.0/frameworks/kernel.framework/source/implementation/xstring_impl.cpp (1094) : Memory leak of 15 bytes () at 0x10ba870e0
    I do not understand this leak because I am a c++ amateur and I can not find the file on my system.  Do you know where this file is and what it is for?
    [...]

    This file contains the string implementation and due to the leak in the paint tool a leak is detected in the strings too (when quitting the app). As this is our internal source code, you can't access it.

    One note regarding your command line: You don't have to add the "g_alloc=debug" argument when you're working with a debug version of your plugin - that is done automatically (in R16). In release mode you can switch the memory allocation to the debug allocator - using this argument - for extended error checking though; the price of course is an increased amount of memory needed for additional debug info and check patterns as well as a speed hit.

    By default the release mode of your plugin will use the faster release memory allocator of course.

    Best regards,

    Wilfried



  • On 09/10/2014 at 08:36, xxxxxxxx wrote:

    Hi Wilfried.  I have to work for a client today.  I will work on this more tomorrow and post what I have figured out.

    Thanks again for your time.

    Joe Buck



  • On 21/10/2014 at 08:28, xxxxxxxx wrote:

    Hi Joe Buck,

    We'd like to know if you've had time to work on this issue?  If so, do you still need help?

    Thanks,

    Joey Gaspe
    SDK Support



  • On 21/10/2014 at 14:48, xxxxxxxx wrote:

    Hi Joey,

    I picked up a few motion graphics jobs and have not had a chance to get into it.  I will probably have some time tomorrow to test things out.  I

    Thank you,

    Joe Buck



  • On 22/10/2014 at 13:51, xxxxxxxx wrote:

    Hi Joey and Wilfried,

    Thanks again for your continued support on this issue.

    Originally posted by xxxxxxxx

    there 's a leak int the liquid painter example

    So I deleted all of the source files except main.cpp.  The Xcode project now contains one source file:

    // main.cpp
    #include "c4d.h"
      
    Bool PluginStart(void)
    {
        Int32* leak = NewObj(Int32);
        *leak = 4444;
        return true;
    }
      
    void PluginEnd(void)
    {
    }
      
    Bool PluginMessage(Int32 id, void* data)
    {
        return false;
    }
    

    Screen grabs of the project's Scheme:

    Console output after using "File -> Quit":

    Application start      : 10/22/14 at 15:21:24
    Executable             : 64 Bit
    Version / Build        : 16.027 / RB113727
    Debugger               : available
    Memory model           : debug
    Startup path           : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16
    Application path       : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/CINEMA 4D.app
    Application executable : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/CINEMA 4D.app/Contents/MacOS/CINEMA 4D
    Resource path          : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/resource
    Module path(s)         : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules
    Temporary path         : file:///var/folders/c2/txkqll0x6332gf7zzb8srnqr0000gn/T
    Prefs path             : file:///Users/joebuck/Library/Preferences/MAXON/CINEMA 4D R16_7B5EB4B8
    Global Prefs path      : file:///Users/joebuck/Library/Preferences/MAXON
    OS version             : OS X 10.9.4
    Processor              : 8x Intel Core i7-4850HQ CPU 
    Computer name          : Joe's MacBook Pro
    Thread Count           : 8
    Cpu Speed (MHz)        : 2300.000
    Application Type       : Modular
    Command line arguments : "-g_alloc=debug" "-NSDocumentRevisionsDebugMode" "YES" 
      
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/c4dplugin.xlib with module(s) net.maxon.c4d.c4dplugin
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/crashhandler.module.xlib with module(s) net.maxon.crashhandler
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/crypt.module.xlib with module(s) net.maxon.crypt
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/image.module.xlib with module(s) net.maxon.image
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/mesh.module.xlib with module(s) net.maxon.mesh
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/misc.module.xlib with module(s) net.maxon.misc
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/network.module.xlib with module(s) net.maxon.network
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/triangulation.module.xlib with module(s) net.maxon.triangulation
    2014-10-22 15:21:24.210 CINEMA 4D[1032:303] setPresentationOptions called with NSApplicationPresentationFullScreen when there is no visible fullscreen window; this call will be ignored.
      
    CrashHandler not installed
    Bonjour found: 522.92
    Memory Leaks Detected:
    /Users/joebuck/MAXON_dev/CINEMA 4D R16/plugins/examples/cinema4dsdk/source/main.cpp (6) : Memory leak of 4 bytes () at 0x11dda6820
    /perforce_buildsystem_osx/c4d_mx_buildsystem_osx/release/16.0/frameworks/kernel.framework/source/implementation/xstring_impl.cpp (1094) : Memory leak of 15 bytes () at 0x10a1850e0
    2 blocks not freed
    

    Revise main.cpp removing the memory leak:

    // main.cpp
    #include "c4d.h"
      
    Bool PluginStart(void)
    {
        return true;
    }
      
    void PluginEnd(void)
    {
    }
      
    Bool PluginMessage(Int32 id, void* data)
    {
        return false;
    }
    

    The Scheme is the same.  Here is the console output using "File -> Quit":

    Application start      : 10/22/14 at 15:24:09
    Executable             : 64 Bit
    Version / Build        : 16.027 / RB113727
    Debugger               : available
    Memory model           : debug
    Startup path           : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16
    Application path       : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/CINEMA 4D.app
    Application executable : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/CINEMA 4D.app/Contents/MacOS/CINEMA 4D
    Resource path          : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/resource
    Module path(s)         : file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules
    Temporary path         : file:///var/folders/c2/txkqll0x6332gf7zzb8srnqr0000gn/T
    Prefs path             : file:///Users/joebuck/Library/Preferences/MAXON/CINEMA 4D R16_7B5EB4B8
    Global Prefs path      : file:///Users/joebuck/Library/Preferences/MAXON
    OS version             : OS X 10.9.4
    Processor              : 8x Intel Core i7-4850HQ CPU 
    Computer name          : Joe's MacBook Pro
    Thread Count           : 8
    Cpu Speed (MHz)        : 2300.000
    Application Type       : Modular
    Command line arguments : "-g_alloc=debug" "-NSDocumentRevisionsDebugMode" "YES" 
      
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/c4dplugin.xlib with module(s) net.maxon.c4d.c4dplugin
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/crashhandler.module.xlib with module(s) net.maxon.crashhandler
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/crypt.module.xlib with module(s) net.maxon.crypt
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/image.module.xlib with module(s) net.maxon.image
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/mesh.module.xlib with module(s) net.maxon.mesh
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/misc.module.xlib with module(s) net.maxon.misc
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/network.module.xlib with module(s) net.maxon.network
    Loading file:///Users/joebuck/MAXON_dev/CINEMA 4D R16/modules/triangulation.module.xlib with module(s) net.maxon.triangulation
    2014-10-22 15:24:09.901 CINEMA 4D[1050:303] setPresentationOptions called with NSApplicationPresentationFullScreen when there is no visible fullscreen window; this call will be ignored.
      
    CrashHandler not installed
    Bonjour found: 522.92
    Memory Leaks Detected:
    /perforce_buildsystem_osx/c4d_mx_buildsystem_osx/release/16.0/frameworks/kernel.framework/source/implementation/xstring_impl.cpp (1094) : Memory leak of 15 bytes () at 0x108c280e0
    1 blocks not freed
    

    There is still a memory leak being reported.

    As I said before, I'm a complete c++ amateur, so I'm probably missing a configuration in my Xcode project that would be a given for you guys.  Please note that R15 memory leak detection is working as expected on this system.

    Please let me know if I can provide any more information to help troubleshoot this problem.

    Thanks again,

    Joe Buck



  • On 23/10/2014 at 10:07, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Hi Joey and Wilfried,
    Thanks again for your continued support on this issue. [...] There is still a memory leak being reported.
    As I said before, I'm a complete c++ amateur, so I'm probably missing a configuration in my Xcode project that would be a given for you guys.  Please note that R15 memory leak detection is working as expected on this system.
    Please let me know if I can provide any more information to help troubleshoot this problem.
    Thanks again,
    Joe Buck

    Please use "g_alloc=debug" when passing that argument in Xcode, not "-g_alloc=debug" as you did.

    Best regards,

    Wilfried



  • On 23/10/2014 at 10:35, xxxxxxxx wrote:

    Hey Wilfried!

    Originally posted by xxxxxxxx

    Please use "g_alloc=debug" when passing that argument in Xcode, not "-g_alloc=debug" as you did.

    Works as expected.  Problem solved.

    Thanks for your time and help,

    Joe Buck


Log in to reply