hlsl2glslfork icon indicating copy to clipboard operation
hlsl2glslfork copied to clipboard

memory leak at glslOutput.cpp

Open crazii opened this issue 9 years ago • 2 comments

hlslang\GLSLCodeGen\glslOutput.cpp : 1867

probable/quick fix:

     StructMember m = StructMember( it->type->getFieldName().c_str(),
                                        (it->type->hasSemantic()) ? it->type->getSemantic().c_str() : "",
                                         translateType(it->type),
                                         structQual,
                                         prec,
                                         it->type->isArray() ? it->type->getArraySize() : 0,
                                        (it->type->getBasicType() == EbtStruct) ? createStructFromType(it->type) : NULL,
                                         structName);
     s->addMember(m);

crazii avatar Mar 22 '15 10:03 crazii

hlsl2glslfork is one of the most leaky pieces of software I've ever encountered. It's only cleanup method is to pull down the internal memory pools. This was a conscious, only partly implemented design decision (partly implemented because I don't believe you can recover from that pull down and translate more shaders afterwards - I'd be happy to be proved wrong on that).

It would be foolhardy to try to fix the leaks. I did it some time ago and can refresh the patches if you wish, but it's neither pretty nor complete. IMHO - without wishing to cause offence to @aras-p who maintains it and isn't responsible for the original design - this software is something of a train wreck.

mingwandroid avatar Mar 22 '15 16:03 mingwandroid

@mingwandroid yes, maybe you're right.my idea is quite simple: this library is useful and try making it better. Even for an offline tool, memory leak can cause work suspended. For me hlsl2glsl/glsl_optimizer is integrated in visual studio. And I encountered its 'OUT OF MEMORY' random crash when performing parallel build with other compiling/building tasks.

crazii avatar Mar 24 '15 06:03 crazii