<div dir="ltr"><div>Hi,</div><div><br></div>It's indeed a bug, thanks a lot for finding this! I'll commit the fix shortly.<div><br></div><div>Regards,</div><div>Brecht.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 17, 2018 at 4:52 PM, Thomas Krebs <span dir="ltr"><<a href="mailto:Thomas.Krebs@mecadtron.de" target="_blank">Thomas.Krebs@mecadtron.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
We are using Cycles within our application with huge data sets.<br>
We didn't encounter any problems with memory so far.<br>
After updating to the latest version 1.9 (we used some previous<br>
unlabeled version before from about November last year) we<br>
encounter a bad alloc exception. It happens using some bigger models,<br>
with small models we don't see this happen...<br>
<br>
Looking around (I do not know too much about the internals...)<br>
I got suspicious about some code in MeshManager::update_svm_attrib<wbr>utes:<br>
<br>
It reads as:<br>
<br>
void MeshManager::update_svm_attrib<wbr>utes(Device *, DeviceScene *dscene, Scene *scene, vector<AttributeRequestSet>& mesh_attributes)<br>
{<br>
        /* for SVM, the attributes_map table is used to lookup the offset of an<br>
         * attribute, based on a unique shader attribute id. */<br>
<br>
        /* compute array stride */<br>
        int attr_map_size = 0;<br>
<br>
        for(size_t i = 0; i < scene->meshes.size(); i++) {<br>
                Mesh *mesh = scene->meshes[i];<br>
                mesh->attr_map_offset = attr_map_size;<br>
                attr_map_size += (mesh_attributes[i].size() + 1)*ATTR_PRIM_TYPES;<br>
        }<br>
<br>
        if(attr_map_size == 0)<br>
                return;<br>
<br>
        /* create attribute map */<br>
        uint4 *attr_map = dscene->attributes_map.alloc(a<wbr>ttr_map_size*scene->meshes.siz<wbr>e());<br>
<br>
<br>
In the last line the product doesn't seem necessary to me. I may be wrong, though.<br>
I changed the line to:<br>
<br>
        uint4 *attr_map = dscene->attributes_map.alloc(a<wbr>ttr_map_size);<br>
<br>
compiled and so far everyting works as expected, even with big data<br>
sets. Can somebody check if this was a bug and fix it accordingly?<br>
<br>
Best regards,<br>
Thomas<br>
-- <br>
Mecadtron GmbH<br>
Sitz der Gesellschaft: Nürnberg<br>
Amtsgericht Nürnberg, HRB20209<br>
Geschäftsführer: Dr. Thomas Krebs<br>
Allersberger Str. 185<br>
90461 Nürnberg<br>
Germany<br>
Tel.: +49 911 462369-0<br>
Fax:  +49 911 462369-11<br>
<a href="http://www.mecadtron.de" rel="noreferrer" target="_blank">www.mecadtron.de</a><br>
<a href="http://www.mecadtron.com" rel="noreferrer" target="_blank">www.mecadtron.com</a><br>
______________________________<wbr>_________________<br>
Bf-cycles mailing list<br>
<a href="mailto:Bf-cycles@blender.org" target="_blank">Bf-cycles@blender.org</a><br>
<a href="https://lists.blender.org/mailman/listinfo/bf-cycles" rel="noreferrer" target="_blank">https://lists.blender.org/mail<wbr>man/listinfo/bf-cycles</a><br>
</blockquote></div><br></div>