Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    R16 memory leaks [SOLVED]

    SDK Help
    0
    18
    2.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              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

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                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

                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

                  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

                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

                    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

                    1 Reply Last reply Reply Quote 0
                    • H
                      Helper
                      last edited by

                      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

                      1 Reply Last reply Reply Quote 0
                      • H
                        Helper
                        last edited by

                        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

                        1 Reply Last reply Reply Quote 0
                        • H
                          Helper
                          last edited by

                          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

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post