Page MenuHome

image has numerous users when only 1 material actually is using it
Closed, InvalidPublic


Window 8.1

Blender Version
Broken: 2.72b 9e963ae

I have an addon that adds siding and you can add materials to that siding with it. Some of the types of siding it adds a image texture to and if you generate the material multiple times and check how many users the image has it says a high number, when really only one material is using it. My code works by adding in an extra material and then using that material to replace the one on the object and then deleting the temporary one. So I don't know if it is just not updating that the material is deleted and not using that image anymore? Here is my code:


  1. Run "" from the text editor
  2. Add Siding "View 3D > Add > Mesh > JARCH Vis > Add Siding
  3. Click "Cycles Materials"
  4. Add image texture
  5. Hit "Generate" several times, note how memory usage jumps
  6. Go to the node editor and note the number of users on the image.

The part of code that adds the materials starts at line 1727

Event Timeline

Jacob Morris (BlendingJake) raised the priority of this task from to 90.
Jacob Morris (BlendingJake) updated the task description. (Show Details)
Jacob Morris (BlendingJake) edited a custom field.
Antonis Ryakiotakis (psy-fi) changed the task status from Unknown Status to Invalid.Nov 6 2014, 3:38 PM
Antonis Ryakiotakis (psy-fi) claimed this task.

Materials never get deleted from the database when you create them unless you close blender - if you search for them in the material search field you will find them. To make sure your image does not have any users you have to basically remove all references of the image from the temporary material. But again creating so many materials looks like a bad idea, you might want to consider caching them.

This looks like working as intended and patch is more than 2000 lines and -sorry to say- written like a wall of text so it's quite hard to figure out what is happening. It would be good to have a few steps with a blend file where image leaking can be demonstrated.

Closing until a real leak can be shown.

@Antonis Ryakiotakis (psy-fi)
The thing is though that the material is being deleted. If you check the material is not there. Did you just run the code and see the issue? I understand that it is hard to read threw other peoples code and it is hard to simplify this down, as when you restart Blender the issue is gone, but to my understanding it shouldn't be holding onto it since the material is no longer listed.

Antonis Ryakiotakis (psy-fi) changed the task status from Invalid to Unknown Status.Nov 6 2014, 3:51 PM

Reopening, confirmed. Materials seem to be deleted also

Thanks @Antonis Ryakiotakis (psy-fi), I do hope to update my code, but this did seem to be a bug.

@Campbell Barton (campbellbarton) I see this is caused by 916a58f4e

I don't have valgrind here to check for details but enabling with address sanitizer seems fine. Also if this is problematic on quit might be worth NULLing out the pointers first on exit or so?

Antonis Ryakiotakis (psy-fi) lowered the priority of this task from 90 to Normal.Nov 6 2014, 4:14 PM

Well, user counters are only guaranteed to be correct after loading the file. Deleting datablocks might cause dangling users for until next save/reload. Making it so user counter is always correct is rather a huge topic and wouldn't really consider this is a bug.

Unless there are more issues here @Antonis Ryakiotakis (psy-fi)?

Antonis Ryakiotakis (psy-fi) changed the task status from Unknown Status to Unknown Status.Dec 26 2014, 11:50 AM

No, that should be it.