Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Bug or no Bug?

    SDK Help
    0
    9
    1.2k
    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

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

      On 27/01/2003 at 05:26, xxxxxxxx wrote:

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

      ---------
      Hello,

      I'm not sure if this is a bug or where my mistake is, but the following code (extracted from C4D_MEMORY.H) makes me some headache:

      ------------------------8<--------------------------

        
      void* operator new(size_t s);  
      void* operator new(size_t s,int line,const CHAR *file);  
      void* operator new[](size_t s);  
      void* operator new[](size_t s,int line,const CHAR *file);  
      void operator delete(void *p);  
      void operator delete[](void *p);  
        
      #define gNew new(__LINE__,__FILE__)  
      #define bNew new(__LINE__,__FILE__)  
        
      #define gDelete(v) {if(v) delete v; v=0;}  
      #define bDelete(v) {if(v) delete [] v; v=0;}  
      

      ------------------------>8--------------------------

      bNew is for array allocation, isnt' it? So shouldn't it read:

        
      #define bNew new[](__LINE__,__FILE__)  
      

      And why is there no deallocation operator with positioning arguments, like:

        
      void operator delete(void *p,int line,const CHAR *file);  
      void operator delete[](void *p,int line,const CHAR *file);  
      

      That causes me some trouble, because if the construction of a new object (during "new" operation) failes, the allocated memory won't be deallocated (at least that tells me the VCC docu in compiler warning C4291).

      A second question: You seem to protocol the allocation position and the corresponding deallocations. Is there a way to read/dump out the protocol, to check for memory leakage?

      It would be great if someone could enlighten me. Ciao,
      Marcus

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

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

        On 27/01/2003 at 13:58, xxxxxxxx wrote:

        The C4291 issue will be fixed in the next API.
        As for bNew I don't know if it's intentional, but new[] and new are both implemented using a simple Alloc() anyway.
        If you create an empty file named "c4d_debug.txt" in the working directory C4D will open its debug console and display memory leaks.

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

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

          On 27/01/2003 at 22:10, xxxxxxxx wrote:

          I fell into the same trap as you on the new[] thing. Of course "bNew BaseTime[20]" is evaluated to "new BaseTime[20]", and there's no such thing as "new[] BaseTime[20]". So everything is alright.

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

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

            On 28/01/2003 at 01:11, xxxxxxxx wrote:

            Yeah LOL, you're right. Perhaps I should get more sleep...

            Thanks (especially for the "c4d_debug.txt" info :)),
            Ciao,
            Marcus

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

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

              On 29/01/2003 at 11:27, xxxxxxxx wrote:

              Hi Mikael,

              today I tried the debug thing but it didn't work. I put an empty text file named "c4d_debug.txt" in the C4D directory (...\MAXON\CINEMA_4D_R8) and startet Cinema -> no debug window. Then I moved this file to the plugin directory -> no debug window. What am I doing wrong here. I even produced some memory leaks, but had no luck.

              It would be really great, if you can help me. I think that this would be a cool feature. Thanks in advance. Ciao,
              Marcus

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

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

                On 29/01/2003 at 14:45, xxxxxxxx wrote:

                You must make sure that it's in the working directory. So if you start from within Visual Studio the file should go next to the .cdl. (I usually place c4d_debug.txt files all over just to be sure... 🙂

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

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

                  On 30/01/2003 at 02:02, xxxxxxxx wrote:

                  I tried several things but it didn't work. I put the text file in the ...\bin-directory of Visual Studio C++. I copied it into the Cinema4D-directory and into the plugin folder - next to the .CDL file.

                  Where does this window open - in Cinema4D, in an extra application window or in Visual Studio?

                  When does this window open - when C4D finds the file, when there are allocations, when I use the VC-debugger or when I compile the plugin in debug configuration?

                  BTW: I'm using VC7 .net Standard - might this be the problem?

                  Ciao,
                  Marcus

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

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

                    On 30/01/2003 at 03:46, xxxxxxxx wrote:

                    Try to place the "c4d_debug.txt" file in the C4D directory and then start C4D manually (i.e. by double-clicking the .exe file). Then a separate window named "DebugOut" should open right away saying "C4D Trace Start...". Otherwise I have no idea what's wrong. I'm using 8.012 in Windows, just like you.

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

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

                      On 30/01/2003 at 05:20, xxxxxxxx wrote:

                      Hi Mikael,

                      thanks a lot for your patience. Now it works. That was the cause: My link to the application had no working directory filled in...
                      You made my day 🙂 This is a great feature. I tested it and have new questions, but don't panic, I try them to answer myself at first.

                      Ciao,
                      Marcus

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