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
    • Recent
    • Tags
    • Users
    • Login

    Free cache + memory within an objectplugin[SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 373 Views
    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 Offline
      Helper
      last edited by

      On 01/05/2015 at 05:42, xxxxxxxx wrote:

      Hi all,

      I´m building a forest plugin with several plant classes.
      As the result of GetVirtualObjects, instances of these classes are returned.

      I managed to start/stop the plant building but if I reactivate the generator, or the cache is used, every plant which was ever built with this generator will be returned.

      I want to free the cache and even memory space, which is filled with the instances, manually.
      Has anybody an idea how to do this?

      Thanks in advance
      Martin

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

        On 02/05/2015 at 03:15, xxxxxxxx wrote:

        some progress here.

        After rewriting the main forest class and do some garbage handling(emptying lists and stuff)
        The refresh works fine.

        But the question remains still.
        Can we get full control over the generators cache, delete it and so on?

        Printing out the used memory with

          
        mem = c4d.storage.GeGetMemoryStat()[c4d.C4D_MEMORY_STAT_MEMORY_INUSE]  
        

        still shows a constant increase of memory usage.
        Do I interpret this value the wrong way?

        If not, how can I free the used memory?

        Any help would be highly appreciated.

        Best wishes
        Martin

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

          On 04/05/2015 at 01:46, xxxxxxxx wrote:

          Hi Martin,

          the increasing memory usage could also be caused by the undo system. There lots of copies of caches and object generators are held. So this does not necessarily a sign, that you are leaking memory.
          In order to investigate the situation, you should run C4D in memory debug mode and watch the output after quitting Cinema 4D (you may want to start C4D from the command line for this to work).

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

            On 04/05/2015 at 03:04, xxxxxxxx wrote:

            Hi Andreas,

            just decreased the undo stack amount manually inside the project settings and it was exactly as you said.
            The increasing memory usage results from the stored undo steps.
            Now that I`m thinking about it, your advice is absolutely logical, but with all these different tasks on my mind I just could not think straight.
            And now there is more homework to do figuring out the debug mode, thanks, Andreas!😉
            Seriously, I´m very thankful for this link and your hint!

            Have fun at the fmx!

            Best wishes
            Martin

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