Fix #34121: OSL + persistent images option was not freeing shader memory properly,
[blender.git] / intern / cycles / render / mesh.cpp
index 57776e4cfa635f7f0eaf34f4cfea13e1f189dba4..3a6fba32b344555e2c8eb75a8c0dc4fbc69a29e6 100644 (file)
@@ -966,6 +966,14 @@ void MeshManager::device_free(Device *device, DeviceScene *dscene)
        dscene->attributes_map.clear();
        dscene->attributes_float.clear();
        dscene->attributes_float3.clear();
+
+       OSLGlobals *og = (OSLGlobals*)device->osl_memory();
+
+       if(og) {
+               og->object_name_map.clear();
+               og->attribute_map.clear();
+               og->object_names.clear();
+       }
 }
 
 void MeshManager::tag_update(Scene *scene)