yes, it adds some memoery usage, but doing the math i found that it isnt too much, <div><br></div><div>for the 8000x8000 problem, each string should be in the worst case length 21 (for example string s = &quot;Ld0x1d2x3d4x5d6x7d8x9&quot; ), assuming std::string is 1 byte per length unit:</div>

<div>stringMemory &lt;= 21 bytes * 64M &lt;=  1344Mbytes &lt;= 1.3GB</div><div><br></div><div>i was considering the equivalent situation but for the expressions, which now are 64M smaller ones compared to 8000 bigger ones from before</div>

<div>could it be that they use so much memory?</div><div><br><br><div class="gmail_quote">On Wed, Oct 20, 2010 at 1:27 PM, James Jackson <span dir="ltr">&lt;<a href="mailto:james.jackson@cern.ch">james.jackson@cern.ch</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">If I understand correctly, previously you were storing N strings, now you are storing N^2. This is 64M strings, as opposed to 8000. This might account for at least some of the memory!<br>


<br>
Regards,<br>
James<br>
<div><div></div><div class="h5"><br>
On 20 Oct 2010, at 16:45, Cristobal Navarro &lt;<a href="mailto:axischire@gmail.com">axischire@gmail.com</a>&gt; wrote:<br>
<br>
&gt; Hello everybody,<br>
&gt;<br>
&gt; i&#39;ve been using ginac for some months and is very optimum,<br>
&gt; but recently i&#39;ve been facing a problem with the amount of memory used to store some expressions.<br>
&gt; i have a linear system of ecuations, with the size of around 8000 elements.<br>
&gt;<br>
&gt; my first approach on building the matrix was use a map&lt;string, ex*&gt; where each element would correspond to a row element of the matrix.<br>
&gt; and all incognints of that row would be inside the expression ex. for a 4x4 system ecuaiton, the storage would be like this<br>
&gt;<br>
&gt; &lt;&quot;certainKey1&quot;, ex1* &gt; = B1*symbol2 + A1*symbol1 + D1*symbol4<br>
&gt; &lt;&quot;certainKey2&quot;, ex2*&gt; = D2*symbol4 + B2*symbol2 + C2*symbol3<br>
&gt; &lt;&quot;certainKey3&quot;, ex3* &gt; = B3*symbol2 + A3*symbol1 + D3*symbol4 + C3*symbol3<br>
&gt; &lt;&quot;certainKey4&quot;, ex4*&gt; = A4*symbol1 + B4*symbol2 + C4*symbol3<br>
&gt;<br>
&gt; this method was using an acceptable ammount of memory, around 15% of 32GB which was pretty good.<br>
&gt; the bad side of this approach was that when building the Ginac::matrix, i had to sort the elements and search each of them on their corresponding row, additionaly some where hidden because they had coefficient &quot;0&quot;, so i had a list of symbols and on each row i searched for them, in a sorted way using the &quot;coeff&quot; method that Ginac provides.<br>


&gt; But i repeat, this was slow.<br>
&gt;<br>
&gt; The point is that i decided to search for other solution, aiming on reducing the time needed to build the Ginac::Matrix.<br>
&gt; i came with the idea to use map&lt; string, &lt;string, ex&gt; &gt; mapMatrix, which is actually the matrix but sorted automatically because of the strings which are the incognits keyCode.<br>
&gt; now building the matrix is almost instant, no search needed, and all elements already sorted.<br>
&gt;<br>
&gt; however, the program is using all the RAM = 32GB when doing the 8000x8000 problem.<br>
&gt;<br>
&gt; i checked and rechecked for any memory leak, but havent found any so far,<br>
&gt;<br>
&gt; now the question = why did memory increase so much for just segmenting the expressions into separated smaller ones??<br>
&gt; is they same ammount of terms, just in separated sub-expressions., the ex object is too expensive??<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; GiNaC-list mailing list<br>
&gt; <a href="mailto:GiNaC-list@ginac.de">GiNaC-list@ginac.de</a><br>
&gt; <a href="https://www.cebix.net/mailman/listinfo/ginac-list" target="_blank">https://www.cebix.net/mailman/listinfo/ginac-list</a><br>
_______________________________________________<br>
GiNaC-list mailing list<br>
<a href="mailto:GiNaC-list@ginac.de">GiNaC-list@ginac.de</a><br>
<a href="https://www.cebix.net/mailman/listinfo/ginac-list" target="_blank">https://www.cebix.net/mailman/listinfo/ginac-list</a><br>
</blockquote></div><br></div>