<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to FBF.FactoryBase PROPERTY prvInstCount</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/370e7c2586/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/370e7c2586/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/370e7c2586/</id><updated>2021-11-19T23:41:48.494000Z</updated><subtitle>Recent posts to FBF.FactoryBase PROPERTY prvInstCount</subtitle><entry><title>FBF.FactoryBase PROPERTY prvInstCount</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/370e7c2586/?limit=25#360b" rel="alternate"/><published>2021-11-19T23:41:48.494000Z</published><updated>2021-11-19T23:41:48.494000Z</updated><author><name>jtebokkel</name><uri>https://forge.codesys.com/u/jtebokkel/</uri></author><id>https://forge.codesys.com1bafa7b9ccd741742b8113f72ebefffabbbc7287</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I may have gotten a better understanding with some new comments provided in the 3.5.17 release.&lt;/p&gt;
&lt;h3 id="fbffactorybase-properties"&gt;FBF.FactoryBase Properties&lt;/h3&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c"&gt;(* Is called by ``prvMemAlloc``, if ``prvPoolAdr`` returns ``CAA.gc_pNULL``*)&lt;/span&gt;
&lt;span class="n"&gt;PROPERTY&lt;/span&gt; &lt;span class="n"&gt;prvInstCount&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;FBF&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CAA&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;COUNT&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c"&gt;(* Is called by ``prvMemAlloc``, if ``prvPoolAdr`` returns not ``CAA.gc_pNULL``.&lt;/span&gt;
&lt;span class="c"&gt; it should be implementet like :code:`prvPoolSize := sizeof(abyPoolMemory)`*)&lt;/span&gt;
 &lt;span class="n"&gt;PROPERTY&lt;/span&gt; &lt;span class="n"&gt;prvInstPoolSize&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;FBF&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CAA&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SIZE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c"&gt;(* Is called by ``prvMemAlloc``, to determine the Methode of allocation. (``MBM.PoolCreateH`` or ``MBM.PoolCreateP``)&lt;/span&gt;
&lt;span class="c"&gt; If the return value is ``CAA.gc_pNULL`` then ``MBM.PoolCreateH`` is used.&lt;/span&gt;
&lt;span class="c"&gt; If the return value is not equal ``CAA.gc_pNULL`` this value is used as a basis for ``MBM.PoolCreateP``*)&lt;/span&gt;
&lt;span class="n"&gt;PROPERTY&lt;/span&gt; &lt;span class="n"&gt;prvInstPoolAdr&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;FBF&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CAA&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;PVOID&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;h1 id="what-seems-to-happen"&gt;What seems to happen&lt;/h1&gt;
&lt;p&gt;As doc comment on &lt;code&gt;prvInstPoolAdr&lt;/code&gt; indicates what this property returns determines if we are using the heap or a pool. I'm presuming that if we are in heap mode that &lt;code&gt;prvInstCount&lt;/code&gt; is used for the value of &lt;code&gt;ctNumBlocks&lt;/code&gt; (the first argument of &lt;code&gt;PoolCreateH&lt;/code&gt;) This value then would signify the initial number of instances that can be created on the heap before the heap pool needs to be extended.&lt;/p&gt;
&lt;p&gt;I don't know what happens when you go down the &lt;code&gt;PoolCreateP&lt;/code&gt; route other than once your initial pool is used up, more memory is allocated some how. I'd guess that it comes from the heap. &lt;/p&gt;
&lt;p&gt;Hopefully this helps someone else down the road.&lt;/p&gt;
&lt;h4 id="if-the-codesys-team-is-listening"&gt;If the codesys team is listening...&lt;/h4&gt;
&lt;p&gt;Please increase the quality of the core library documentation. It would make working in this environment so much more pleasant. So many times I'm having to dig through layers and layers to find the bit that clears it up or just end up not able to find what I need.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>FBF.FactoryBase PROPERTY prvInstCount</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/370e7c2586/?limit=25#1091" rel="alternate"/><published>2020-06-10T20:32:02.549000Z</published><updated>2020-06-10T20:32:02.549000Z</updated><author><name>jtebokkel</name><uri>https://forge.codesys.com/u/jtebokkel/</uri></author><id>https://forge.codesys.com0958246e5a800b2445067d21391ba34d0f3958a4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;PROPERTY&lt;/span&gt; &lt;span class="nv"&gt;prvInstCount&lt;/span&gt; : &lt;span class="nv"&gt;CAA&lt;/span&gt;.&lt;span class="nv"&gt;COUNT&lt;/span&gt; &lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nv"&gt;ctInst&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;

&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="nv"&gt;prvInstCount&lt;/span&gt;.&lt;span class="nv"&gt;Get&lt;/span&gt; &lt;span class="nv"&gt;body&lt;/span&gt;
&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nv"&gt;Please&lt;/span&gt; &lt;span class="nv"&gt;choose&lt;/span&gt; &lt;span class="nv"&gt;a&lt;/span&gt; &lt;span class="nv"&gt;proper&lt;/span&gt; &lt;span class="nv"&gt;value&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nv"&gt;prvInstCount&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;prvInstCount&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I can't seem to find any documentation on what a "proper" value is for this property or even what specifically it is supposed to be. By the name I would think it to be the Instance Count, but then how does one keep track of that? a VAR_STAT and FB_Init to increment it?&lt;/p&gt;
&lt;p&gt;leaving this value as 10 seems to work, but that just confuses me more.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>