<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof ContentPasted1 ContentPasted2">I added this line but it doesn't change anything `cairo_show_text( w->cr, par1 ? malloc_strdup( par1 ) : NULL );`<br class="ContentPasted1">
</div>
<div class="elementToProof ContentPasted1">Below is the source code.<br>
</div>
<div class="elementToProof ContentPasted1"><br>
</div>
<div class="elementToProof"><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="ContentPasted0"><a href="https://github.com/dev-harbour/bluesea/blob/main/src/bluesea.c#L457" id="LPlnk584305">https://github.com/dev-harbour/bluesea/blob/main/src/bluesea.c#L457</a><br>
</span></div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div class="elementToProof" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div class="elementToProof ContentPasted3" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Tests also performed on this source code does not change anything:<br>
</div>
<div class="elementToProof ContentPasted3" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div class="elementToProof ContentPasted3" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
```</div>
<div class="elementToProof ContentPasted3" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<div style="color:#d4d4d4;background-color:#1e1e1e;font-family:'Roboto Mono', Consolas, 'Courier New', monospace;font-weight:normal;line-height:22px">
<span><span class="ContentPasted4"> </span><span style="color:#4ec9b0" class="ContentPasted4">cairo_scaled_font_t</span><span class="ContentPasted4"> *scaled_face =
</span><span style="color:#dcdcaa" class="ContentPasted4">cairo_get_scaled_font</span><span class="ContentPasted4">( w-></span><span style="color:#9cdcfe" class="ContentPasted4">cr</span><span class="ContentPasted4"> );</span></span>
<div><span class="ContentPasted4"> </span><span style="color:#4ec9b0" class="ContentPasted4">cairo_glyph_t</span><span class="ContentPasted4"> *</span><span style="color:#9cdcfe" class="ContentPasted4">glyphs</span><span class="ContentPasted4"> =
</span><span style="color:#dcdcaa" class="ContentPasted4">malloc</span><span class="ContentPasted4">( (
</span><span style="color:#dcdcaa" class="ContentPasted4">strlen</span><span class="ContentPasted4">( par1 ) ) *
</span><span style="color:#569cd6" class="ContentPasted4">sizeof</span><span class="ContentPasted4">(
</span><span style="color:#4ec9b0" class="ContentPasted4">cairo_glyph_t</span><span class="ContentPasted4"> ) );</span></div>
<div><span class="ContentPasted4"> </span><span style="color:#569cd6" class="ContentPasted4">int</span><span class="ContentPasted4"> </span><span style="color:#9cdcfe" class="ContentPasted4">glyph_count</span><span class="ContentPasted4">;</span></div>
<div><span class="ContentPasted4"> </span><span style="color:#4ec9b0" class="ContentPasted4">cairo_text_cluster_t</span><span class="ContentPasted4"> *</span><span style="color:#9cdcfe" class="ContentPasted4">clusters</span><span class="ContentPasted4"> =
</span><span style="color:#569cd6" class="ContentPasted4">NULL</span><span class="ContentPasted4">;</span></div>
<div><span class="ContentPasted4"> </span><span style="color:#569cd6" class="ContentPasted4">int</span><span class="ContentPasted4"> </span><span style="color:#9cdcfe" class="ContentPasted4">cluster_count</span><span class="ContentPasted4">;</span></div>
<div><span class="ContentPasted4"> </span><span style="color:#4ec9b0" class="ContentPasted4">cairo_text_cluster_flags_t</span><span class="ContentPasted4"> </span><span style="color:#9cdcfe" class="ContentPasted4">clusterflags</span><span class="ContentPasted4">;</span></div>
<div><span class="ContentPasted4"> </span><span style="color:#4ec9b0" class="ContentPasted4">cairo_font_extents_t</span><span class="ContentPasted4"> </span><span style="color:#9cdcfe" class="ContentPasted4">extents</span><span class="ContentPasted4">;</span></div>
<br class="ContentPasted4">
<div><span class="ContentPasted4"> </span><span style="color:#dcdcaa" class="ContentPasted4">hex_to_rgb</span><span class="ContentPasted4">( w-></span><span style="color:#9cdcfe" class="ContentPasted4">cr</span><span class="ContentPasted4">, par4 );</span></div>
<div><span class="ContentPasted4"> </span><span style="color:#dcdcaa" class="ContentPasted4">cairo_scaled_font_extents</span><span class="ContentPasted4"> (
</span><span style="color:#9cdcfe" class="ContentPasted4">scaled_face</span><span class="ContentPasted4">, &</span><span style="color:#9cdcfe" class="ContentPasted4">extents</span><span class="ContentPasted4"> );</span></div>
<div><span class="ContentPasted4"> </span><span style="color:#dcdcaa" class="ContentPasted4">cairo_scaled_font_text_to_glyphs</span><span class="ContentPasted4">(
</span><span style="color:#9cdcfe" class="ContentPasted4">scaled_face</span><span class="ContentPasted4">,
</span><span style="color:#9cdcfe" class="ContentPasted4">par2</span><span class="ContentPasted4">,
</span><span style="color:#9cdcfe" class="ContentPasted4">par3</span><span class="ContentPasted4">,
</span><span style="color:#9cdcfe" class="ContentPasted4">par1</span><span class="ContentPasted4">,
</span><span style="color:#9cdcfe" class="ContentPasted4">strlen</span><span class="ContentPasted4">( par1 ), &</span><span style="color:#9cdcfe" class="ContentPasted4">glyphs</span><span class="ContentPasted4">, &</span><span style="color:#9cdcfe" class="ContentPasted4">glyph_count</span><span class="ContentPasted4">,
&</span><span style="color:#9cdcfe" class="ContentPasted4">clusters</span><span class="ContentPasted4">, &</span><span style="color:#9cdcfe" class="ContentPasted4">cluster_count</span><span class="ContentPasted4">, &</span><span style="color:#9cdcfe" class="ContentPasted4">clusterflags</span><span class="ContentPasted4"> );</span></div>
<div><span class="ContentPasted4"> </span><span style="color:#dcdcaa" class="ContentPasted4">cairo_show_text_glyphs</span><span class="ContentPasted4"> ( w-></span><span style="color:#9cdcfe" class="ContentPasted4">cr</span><span class="ContentPasted4">,
par1, </span><span style="color:#dcdcaa" class="ContentPasted4">strlen</span><span class="ContentPasted4">( par1 ), glyphs, glyph_count, clusters, cluster_count, clusterflags );</span></div>
<div><span class="ContentPasted4"> </span><span style="color:#dcdcaa" class="ContentPasted4">free</span><span class="ContentPasted4">(
</span><span style="color:#9cdcfe" class="ContentPasted4">glyphs</span><span class="ContentPasted4"> );</span></div>
<span><span class="ContentPasted4"> </span><span style="color:#dcdcaa" class="ContentPasted4">cairo_text_cluster_free</span><span class="ContentPasted4">(
</span><span style="color:#9cdcfe" class="ContentPasted4">clusters</span><span class="ContentPasted4"> );</span></span>
<div><span style="color:#6a9955"></span></div>
</div>
<br>
</div>
<div class="elementToProof ContentPasted3" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
```</div>
<div id="appendonsend" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div id="appendonsend" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
--Rafał </div>
<div id="appendonsend" style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Od:</b> Luca Bacci <luca.bacci982@gmail.com><br>
<b>Wysłane:</b> czwartek, 8 grudnia 2022 12:07<br>
<b>Do:</b> Rafał Jopek <rafaljopek@hotmail.com><br>
<b>DW:</b> cairo@cairographics.org <cairo@cairographics.org><br>
<b>Temat:</b> Re: [cairo] Memory leak when using cairo_show_text</font>
<div> </div>
</div>
<div>
<div dir="auto">Consider that Cairo internally keeps a glyph cache, so the memory increase you experience may just be due to internal caching. Can you share the code and some data? I can make some test
<div dir="auto"><br>
</div>
<div dir="auto">Luca</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">Il gio 8 dic 2022, 12:01 Rafał Jopek <<a href="mailto:rafaljopek@hotmail.com" data-auth="NotApplicable">rafaljopek@hotmail.com</a>> ha scritto:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div><span style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">MSYS2 was used in the tests<br>
Version Cairo 1.17.6-3<br>
</span></div>
<div id="x_m_3973450193030754482appendonsend" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
</div>
<div id="x_m_3973450193030754482appendonsend" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
</div>
<div id="x_m_3973450193030754482appendonsend" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
--Rafał </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block; width:98%">
<div id="x_m_3973450193030754482divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Od:</b> Luca Bacci <<a href="mailto:luca.bacci982@gmail.com" data-auth="NotApplicable">luca.bacci982@gmail.com</a>><br>
<b>Wysłane:</b> czwartek, 8 grudnia 2022 11:29<br>
<b>Do:</b> Rafał Jopek <<a href="mailto:rafaljopek@hotmail.com" data-auth="NotApplicable">rafaljopek@hotmail.com</a>><br>
<b>DW:</b> <a href="mailto:cairo@cairographics.org" data-auth="NotApplicable">cairo@cairographics.org</a> <<a href="mailto:cairo@cairographics.org" data-auth="NotApplicable">cairo@cairographics.org</a>><br>
<b>Temat:</b> Re: [cairo] Memory leak when using cairo_show_text</font>
<div> </div>
</div>
<div>
<div dir="auto">Hello Rafał,
<div dir="auto"><br>
</div>
<div dir="auto">Which OS are you using and which Cairo version?</div>
<div dir="auto"><br>
</div>
<div dir="auto">Luca</div>
</div>
<br>
<div>
<div dir="ltr">Il gio 8 dic 2022, 11:02 Rafał Jopek <<a href="mailto:rafaljopek@hotmail.com" data-auth="NotApplicable">rafaljopek@hotmail.com</a>> ha scritto:<br>
</div>
<blockquote style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div><span style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">Hi,</span></div>
<div><span style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)"><br>
</span></div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt">Tests done on function </span><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt; display:inline!important">`cairo_show_text`</span><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
and also other functions that draw text cause</span><br>
</div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt">increasing the physical memory used by the active process.<br>
</span></div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt"><br>
</span></div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt">For example if I use function to draw shapes `cairo_rectangle` or other</span><br>
</div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt">Everything is fine, the memory behaves perfectly.<br>
</span></div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt"><br>
</span></div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt">Kind regards,<br>
</span></div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt">--Rafał</span></div>
<div><span style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif; font-size:12pt"><br>
</span></div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</body>
</html>