Possible memory leak?



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

    On 16/01/2011 at 19:19, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10.111 
    Platform:    Mac  ;  Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Howdy,

    I'm not really sure about this, but there is something strange going on here.

    I'm developing and testing my plugin in R10.111, and my work flow is: compile, start Cinema 4D, import a file, check the result, quit Cinema 4D and then repeat several times throughout the day. But the further along I go, the longer it takes for the Mac OS file selector dialog to pop up after selecting my import command. When I first boot the computer, load Cinema 4D and select my import command the file selector dialog pops up immediately, but as the work progresses through the day it begins to delay more and more. If I reboot the machine, the file selector dialog comes up immediately again.

    The only thing I've noticed is that when I run Activity Monitor, I notice that the "Inactive" memory keeps increasing every time I start and quit Cinema 4D, and test my import command. I have the "c4d_debug.txt" file in the root directory of Cinema 4D, but it hasn't reported any memory leaks.

    Does this situation indicate a memory leak?

    I am using std::vector to keep track of the nodes imported and I'm freeing up the memory like this:

    while(nodeList.size() > 0)
    {
        delete(nodeList.back());
        nodeList.pop_back();
    }
    nodeList.clear();
    

    ... is this the proper way to free up the memory used by the std::vector? The "nodeList" is storing a list of structures that hold information about the nodes.

    Adios,
    Cactus Dan



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

    On 17/01/2011 at 01:49, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    <ADDRESS>
    User Information:
    Cinema 4D Version:   10.111 
    Platform:    Mac  ; 
    Mac OSX  ; 
    Language(s) :    
    C++  ;

    ---------
    </ADDRESS> Howdy,
    I'm not really sure about this, but there is something strange going on here.
    I'm developing and testing my plugin in R10.111, and my work flow is: compile, start Cinema 4D, import a file, check the result, quit Cinema 4D and then repeat several times throughout the day. But the further along I go, the longer it takes for the Mac OS file selector dialog to pop up after selecting my import command. When I first boot the computer, load Cinema 4D and select my import command the file selector dialog pops up immediately, but as the work progresses through the day it begins to delay more and more. If I reboot the machine, the file selector dialog comes up immediately again.
    The only thing I've noticed is that when I run Activity Monitor, I notice that the "Inactive" memory keeps increasing every time I start and quit Cinema 4D, and test my import command. I have the "c4d_debug.txt" file in the root directory of Cinema 4D, but it hasn't reported any memory leaks.
    Does this situation indicate a memory leak?
    [...]
    Adios,
    Cactus Dan

    A few remarks:
    - "Inactive" in the Activity Monitor indicates memory that was used before and is used now (by the OS) for caching (e.g. once you've started Cinema, it will hold a copy of Cinema in this cache and use it when starting it again - as long as the files don't change). If the OS is running low on memory, it starts pushing out old entries from this inactive memory (cache). Nothing to worry about, but something you can't control in your code (if their caching scheme makes your machine running more and more into VM, it will get slower and slower...). The best remedy I know is adding more RAM, if their caching scheme puts you constantly into VM...

    - If you quit Cinema, all memory (allocated for this process) will be released. This can't be a source of memory leaking (that slows down the file selector).

    Best regards,

    Wilfried Behne



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

    On 18/01/2011 at 10:55, xxxxxxxx wrote:

    Howdy,

    OK, thanks for the information.

    Well, I ran the Disk Utility on the hard drive and repaired permissions, and that seemed to help with the delay problem of the file selector dialog.

    But, in searching for what the problem was, I also discovered an obscure memory leak in my code where it wasn't freeing an array after the import command was finished. 😊

    Adios,
    Cactus Dan


Log in to reply