Daz not releasing resources

Ok let's start with the fundemanentals, as I am sure that most people will ask for them in order to determine the cause of the issue:

CPU: Intel I-7-12700K ~3.6 GHZ
Ram: 64GB
Video Card 1: Nvidia GeForce RTX 4070 12GB
Video Card 2: Nvidia GeForce RTX 3080TI 12GB

I continuously run into situations where Daz will render a scene a single time, but then tell me that there are no workers available to render another scene. This is fixed by closing Daz Studio and ending the task thread via Task Manager, but only for 1 more render, after which I have to do the whole process again.

The fact that I am not closing or changing anything else on my system during that time leads me to believe that Daz is not properly cleaning up the resources it is using after rendering, otherwise the same workers it used for the first run should be available. At the same, while my system is not on the level of an animation studio, it is not weak in regards to the resources available to it, so rendering a scene with 5 characters all Render SubD Level 2 at maximum, shouldn't be such an issue that it requires me constantly killing Daz over and over.

Any way to force Daz to clean up the resources it used, or is this a limitation of the product? I certainly never want to revert to CPU rendering, as that's ridiculously slow and avoiding it is the reason I have multiple graphics cards for Daz to use, so right now it just seems like poor resource management, disposal and clean up from my point of view. Maybe some additional insight, if anyone has it, would help me better understand why this is such a problem for Daz Studio

Comments

  • Don't force quit - you may corrupt settings, or even the database used by the content management service.

    Are you closing the render wndows or leaving them open (assuming you don't just render direct to disc)?

  • Richard Haseltine said:

    Don't force quit - you may corrupt settings, or even the database used by the content management service.

    Are you closing the render wndows or leaving them open (assuming you don't just render direct to disc)?

    Not force quitting means waiting for Daz to release the resources and end it's own task which can take an interminable amount of time, though I get the reasoning behind it. I save the render, which closes the window before starting a new one. 

  • You may hav a badly-behaved plug-in, though sadly 12GB isn't an enormous amount of GPU memory. You could try runing http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/plugins/plugins_load_config/start to turn off all third-party plug-ins, then restart DS and see if you get the same issue. If that fixed it try turning plug-ins back on in Help>About Installed Plug-ins and restarting DS until you find a culprit.

  • Richard Haseltine said:

    You may hav a badly-behaved plug-in, though sadly 12GB isn't an enormous amount of GPU memory. You could try runing http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/plugins/plugins_load_config/start to turn off all third-party plug-ins, then restart DS and see if you get the same issue. If that fixed it try turning plug-ins back on in Help>About Installed Plug-ins and restarting DS until you find a culprit.

    So there's no way to force Daz to release the resources it used then? I only ask because I am relatively sure that I already know what the issue is in regards to heavy resource usage, but Daz should be cleaning up the resources it uses after each render. The fact that it can render once, but then not again without a shutdown, tells me that it is not garbage collecting and disposing of used resources and threads efficiently. Even with a problem model, which I think is the cause but also not something I can change at this point, if it can render once it should be able to do so again if there are no memory leaks and appropriate clean up is occuring. 

  • crosswindcrosswind Posts: 6,169
    edited December 2023

    I may suggest you go for a test, no matter you use one of your cards or both of them to render that scene. Download and install GPU-Z (https://www.techpowerup.com/download/techpowerup-gpu-z/).

    While rendering, monitor and write down the data of Memory Used (VRAM) on GPU-Z's panel. Pay close attention to the "Display card" because all the 2GB VRAM consumption from Iray Render Engine is afforded by the display card and "this consumption" will be only released when you close DS session. (VRAM consumption from the scene itself is released after you close the render window, 98+%...)

    If you find that Memory Used of your display card nearly approaches 12GB, it'll be not good...as it might result in potential fallback to CPU when you go for 2nd render. But if it's not such a case, in principle and in most cases, if you can render the scene once, you can render the same scene twice without relaunch DS... as per my experience of having done thousands of renders with 2 - 4 cards.

    To me: RAM/VRAM management in DS is not that bad....though it's not 100% perfect.

     

    Post edited by crosswind on
  • If something (Iray or another plug-in) is holding on to memory what could Daz (Studio, I assume you mean) do? It has no way to know whether the memory use is legitimate, and no idea what would happen if the memory was cleared by anything other than the process that holds it.

  • Richard Haseltine said:

    If something (Iray or another plug-in) is holding on to memory what could Daz (Studio, I assume you mean) do? It has no way to know whether the memory use is legitimate, and no idea what would happen if the memory was cleared by anything other than the process that holds it.

    Not to derail the thread from the intended topic but I just wanted to note that yes they absolutely could and should be able to affect those things if they are the application launching the plug-in and shutting down their application releases the resources. Many applications already do this, across all different genres of software, for instance every single ESB on the market which allows for third-party plug-ins or connectors. It's a matter of properly implementing the hosting for the plug-ins and only allowing said plug-ins to allocate resources using Daz Studio as the proxy for those resources.

    But like I said, it's not a plug-in causing the issue, it's a third party model. I know this because I can render other scenes on the same system over and over and over with no slow down or issues. Which is why I wanted to know if I could force Daz to clear the allocated resources, which are obviously being used as a result of the model being problematic, without having to force close the application.

  • TimberWolfTimberWolf Posts: 285
    edited December 2023

    There is a script that is shipped as part of Studio that used to do precisely that - release the VRAM allocation - but it hasn't worked for ... who knows how long. A very long time anyway. It's almost certainly in your content library:

    Daz 3D Library -> Scripts -> Utilities -> Purge Memory.

    Re. garbage collection: this could very well be an iRay issue rather than a Studio issue. The fact that this script used to work and now doesn't suggests Nvidia removed functionality or, at least, access to that functionality from the API. I do not think that this is down to a specific model in your scene per se - it's more likely that iRay doesn't free up the resources it requests properly. Semantics, I know, but it's not a fault with the model as such.

    At the end of the day there is no way for you or I to release VRAM through scripting or any other means. You have to restart Studio.

    If you are doing lots of renders one after the other, especially unsupervised as we do, I would recommend ManFriday's render queue product - https://www.daz3d.com/render-queue-3

    It can brute force its way through the problem with a shutdown and restart of Studio after each render if you want it to. Should you have to buy something to solve a problem that really shouldn't exist? Of course not, but I do suspect this one is not on Daz - it's on Nvidia.

    Post edited by TimberWolf on
  • crosswindcrosswind Posts: 6,169

    TimberWolf said:

    There is a script that is shipped as part of Studio that used to do precisely that - release the VRAM allocation - but it hasn't worked for ... who knows how long. A very long time anyway. It's almost certainly in your content library:

    Daz 3D Library -> Scripts -> Utilities -> Purge Memory.

    Re. garbage collection: this could very well be an iRay issue rather than a Studio issue. The fact that this script used to work and now doesn't suggests Nvidia removed functionality or, at least, access to that functionality from the API. I do not think that this is down to a specific model in your scene per se - it's more likely that iRay doesn't free up the resources it requests properly. Semantics, I know, but it's not a fault with the model as such.

    At the end of the day there is no way for you or I to release VRAM through scripting or any other means. You have to restart Studio.

    If you are doing lots of renders one after the other, especially unsupervised as we do, I would recommend ManFriday's render queue product - https://www.daz3d.com/render-queue-3

    It can brute force its way through the problem with a shutdown and restart of Studio after each render if you want it to. Should you have to buy something to solve a problem that really shouldn't exist? Of course not, but I do suspect this one is not on Daz - it's on Nvidia.

    That script still works for me, buddy smiley ~~ but I have to say it is used to clear undo stack in RAM rather than allocated VRAM...

    It still helps me to "purge" the unused texture maps from that "long list" in each map slot, haha ~

  • PerttiAPerttiA Posts: 10,010

    One thing that can make closing DS take forever, is having several copies of morphs installed. They may have come with some erranously packaged product with the morphs installed into wrong locations (Creator folders)

    Otherwise the problem with not releasing VRAM seems to effect newer versions of DS, the problem does not exist in DS 4.15

  • I'm running DS Public Beta v4.21.48 and have modified my exit workflow to simply do the following:

    1) Save the scene I'm working on

    2) File ->  New to clear the scene

    3) File -> Exit

    The DAZ Studio client exits/disappears.  Then I go to the Windows Task Manager - Processes tab and find the DAZ Studio process and just watch until it disappears.   This usually only takes about 10-15 seconds, which is a great improvement over earlier builds.  They seem to have performed some optimization with internal object cleanup/teardown within the last couple of beta releases ( up through v4.21.48), as it's much faster than before.

    As Richard mentioned, forcing the exit can cause bad things to happen to the database and settings.  Just give it the 15-30 seconds it needs.

    Regards,

    Olo

Sign In or Register to comment.