[reportlab-users] rednerSVG drawToString

Robin Becker reportlab-users@reportlab.com
Sat, 21 Sep 2002 20:55:43 +0100


>> I had the need to render SVG in memory. I placed a
>> drawToString()-Function in renderSVG:
>> 
>> def drawToString(d, showBoundary=rl_config.showBoundary):
>>     "Returns a SVG as a string in memory, without touching the disk"
>>     s = getStringIO()
>>     drawToFile(d, s, showBoundary=showBoundary)
>>     return s.getvalue()
>
>nothing to do with RL but Python :
>
>does anyone know if such a memory buffer is ever released (freed ?)
>even if s.close() is never called ?
>
s will disappear when it goes out of scope, I'm not sure if getvalue
returns a copy or a reference to the internal buffer, but eitherway the
memory will be freed when the ref counts go to zero.
>thanks in advance for any info, the Python library doc isn't
>clear on this point.
.......
-- 
Robin Becker