<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to "Out of global data memory". Is there a way to increase the memory?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33f78c733f/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33f78c733f/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/33f78c733f/</id><updated>2022-03-28T17:33:17.943000Z</updated><subtitle>Recent posts to "Out of global data memory". Is there a way to increase the memory?</subtitle><entry><title>"Out of global data memory". Is there a way to increase the memory?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33f78c733f/?limit=25#bb58" rel="alternate"/><published>2022-03-28T17:33:17.943000Z</published><updated>2022-03-28T17:33:17.943000Z</updated><author><name>sgronchi</name><uri>https://forge.codesys.com/u/sgronchi/</uri></author><id>https://forge.codesys.coma712be15893b4dc7d56656d0da48b004e0a60668</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;a href="https://en.m.wikipedia.org/wiki/Sparse_voxel_octree" rel="nofollow"&gt;https://en.m.wikipedia.org/wiki/Sparse_voxel_octree&lt;/a&gt;&lt;br/&gt;
&lt;a href="https://en.m.wikipedia.org/wiki/K-d_tree" rel="nofollow"&gt;https://en.m.wikipedia.org/wiki/K-d_tree&lt;/a&gt;&lt;br/&gt;
&lt;a href="https://en.m.wikipedia.org/wiki/Point_cloud" rel="nofollow"&gt;https://en.m.wikipedia.org/wiki/Point_cloud&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://duckduckgo.com/?t=ffsb&amp;amp;q=point+cloud+data+structures&amp;amp;ia=web" rel="nofollow"&gt;https://duckduckgo.com/?t=ffsb&amp;amp;q=point+cloud+data+structures&amp;amp;ia=web&lt;/a&gt;&lt;br/&gt;
&lt;a href="https://stackoverflow.com/questions/29145859/advice-on-data-structure-for-point-clouds" rel="nofollow"&gt;https://stackoverflow.com/questions/29145859/advice-on-data-structure-for-point-clouds&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You NEVER convert it into a full-blown 3D matrix.&lt;/p&gt;
&lt;p&gt;If you are only doing a touch-probe scan, you could get away with a linear array or even with a "last point", i.e. 6 coordinates, and move by delta (maybe checking that you did not touch that point before).&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>"Out of global data memory". Is there a way to increase the memory?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33f78c733f/?limit=25#a8bc" rel="alternate"/><published>2022-03-28T16:56:42.179000Z</published><updated>2022-03-28T16:56:42.179000Z</updated><author><name>leandroct</name><uri>https://forge.codesys.com/u/leandroct/</uri></author><id>https://forge.codesys.coma53fee5ca73726b322a00e31d165f5e077fda73b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I couldn't imagine a logic that would analyze the readings next to the current point, in all 3D directions, without having to convert the sparse matrix into a 3D matrix before processing (only in the region analyzed at the moment). That would solve it, but I'm guessing I'll have processing speed issues. But I will analyze. Thank you again.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>"Out of global data memory". Is there a way to increase the memory?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33f78c733f/?limit=25#3633" rel="alternate"/><published>2022-03-28T16:44:44.840000Z</published><updated>2022-03-28T16:44:44.840000Z</updated><author><name>sgronchi</name><uri>https://forge.codesys.com/u/sgronchi/</uri></author><id>https://forge.codesys.comfb4f2aba52fa86050e5fcf488e4ab39b7479682e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;So I guessed correctly that you were trying to build a point cloud (and that's where the "at least 99.99% will always be FALSE" came from ;-) ) and that's exactly the reason why they're always stored in a sparse matrix (that could range from a simple linear array storing coordinates to more complex data structures).&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>"Out of global data memory". Is there a way to increase the memory?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33f78c733f/?limit=25#e650" rel="alternate"/><published>2022-03-28T16:38:50.473000Z</published><updated>2022-03-28T16:38:50.473000Z</updated><author><name>leandroct</name><uri>https://forge.codesys.com/u/leandroct/</uri></author><id>https://forge.codesys.comd09febe561855dd97630fdc3cff00cdfc0124a92</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks to all by the answers.&lt;br/&gt;
-   I use 64 bits Codesys.&lt;br/&gt;
-   I saw the Target memory settings that you said, sgronchi. Thanks! But really it can’t reach my needed memory even if I increase my PC memory, if I understood.&lt;br/&gt;
-   To explain about why I want this big array, my application does a 3D reading of an area with size x(600cm), y(3000cm) and z(650cm). To create a logic that navigate in the space to analyze the objects and surfaces is very hard to me unless I could put the read points in a 3D array. In this case, each BOOL representing 1 square cm is enough for me. The BOOL array TRUE values would vary, but I think 5 to 10% is a default we can imagine.&lt;br/&gt;
-   Interesting the Sparce Matrix idea. I can think about it.&lt;br/&gt;
If I have no solution by this way, then I will need to think in a new way. But my main question here was answered by sgronchi. Thanks to all!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>"Out of global data memory". Is there a way to increase the memory?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33f78c733f/?limit=25#f243/a74c" rel="alternate"/><published>2022-03-28T16:03:25.713000Z</published><updated>2022-03-28T16:03:25.713000Z</updated><author><name>fajean</name><uri>https://forge.codesys.com/u/fajean/</uri></author><id>https://forge.codesys.com39209e34efc87c10f824a6c1bab21843ad3ce5ff</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;You are right, my comment was based on an incorrect recollection of packing mode behavior.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>"Out of global data memory". Is there a way to increase the memory?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33f78c733f/?limit=25#f243" rel="alternate"/><published>2022-03-28T15:48:41.501000Z</published><updated>2022-03-28T15:48:41.501000Z</updated><author><name>sgronchi</name><uri>https://forge.codesys.com/u/sgronchi/</uri></author><id>https://forge.codesys.com9aa56346638e44acf1aa523fc212937a310956d1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;a href="https://help.codesys.com/webapp/_cds_pragma_attribute_pack_mode;product=codesys;version=3.5.16.0" rel="nofollow"&gt;https://help.codesys.com/webapp/_cds_pragma_attribute_pack_mode;product=codesys;version=3.5.16.0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;1-byte variables are always packed at byte addresses irrespective of the pack mode.&lt;br/&gt;
You can verify experimentally for yourself (I did it on x86, x86_64, ARM Cortex-A and PowerPC e200z7).&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>"Out of global data memory". Is there a way to increase the memory?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33f78c733f/?limit=25#2f7e/f62b" rel="alternate"/><published>2022-03-28T15:42:33.530000Z</published><updated>2022-03-28T15:42:33.530000Z</updated><author><name>fajean</name><uri>https://forge.codesys.com/u/fajean/</uri></author><id>https://forge.codesys.com7ac76b7b2ed100df11ea73bfbae7a8727c4bdc1a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;A BOOL is a 1-byte value, but the CPU reads and writes memory as 4-byte values (32-bit) or 8-byte values (64-bit). The actual space occupied by a BOOL in a structure will depend on the packing mode.  If BOOL arrays use single byte alignment, this means CODESYS performs byte-manipulation under the hood, which is certainly possible. I would like to know if this is documented somewhere, and a reliable behavior irrespective of platform.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>"Out of global data memory". Is there a way to increase the memory?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33f78c733f/?limit=25#2f7e" rel="alternate"/><published>2022-03-28T15:31:12.582000Z</published><updated>2022-03-28T15:31:12.582000Z</updated><author><name>sgronchi</name><uri>https://forge.codesys.com/u/sgronchi/</uri></author><id>https://forge.codesys.comb9c4e9d9e408a6109aa878d44c5e3efe7b3e6d49</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;A BOOL is stored as 1 byte, 8 BOOLs are stored in 1 64-bit word or 2 32-bit word.&lt;br/&gt;
But even if you pack 8 BOOLs/byte you have 1,4 GB of data for each array. And this is a &lt;strong&gt;giant code smell&lt;/strong&gt; for PLC code. That's why the default size is 4 kB (almost always you need less than 1 kB), not including visualization which gets a separate area.&lt;/p&gt;
&lt;p&gt;If I guessed correctly your target application, at least 99.99% of these BOOLs will always be FALSE. Perhaps you should look into sparse matrices representation?&lt;br/&gt;
Anyway, this post is a clear example of the XY Problem: &lt;a href="https://xyproblem.info/" rel="nofollow"&gt;https://xyproblem.info/&lt;/a&gt; so please detail what is the original problem you are trying to solve.&lt;/p&gt;
&lt;p&gt;For reference:&lt;br/&gt;
You can override runtime memory size by right clicking on Application -&amp;gt; Properties -&amp;gt; Target memory settings -&amp;gt; Override memory settings, but the max you can go is 2 GB (you'd need at least 3 GB with those arrays).&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>"Out of global data memory". Is there a way to increase the memory?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33f78c733f/?limit=25#72aa" rel="alternate"/><published>2022-03-26T22:06:15.409000Z</published><updated>2022-03-26T22:06:15.409000Z</updated><author><name>fajean</name><uri>https://forge.codesys.com/u/fajean/</uri></author><id>https://forge.codesys.comd80e740e62173a28cdd0b2132c2e73bc66137c3e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;That is a pretty big array.  It has 1170000000 entries. If you use a 32-bit runtime, I assume each BOOL eats up a whole 4-byte word, so this works out to more than 4Gb of memory, which would typically be the limit a 32-bit process can address under the best circumstances.&lt;/p&gt;
&lt;p&gt;If you are using a 64-bit runtime, this doubles the memory used because memory is addressed in 8-byte words. I am not sure a 9GB+ contiguous array should be expected to fit in a machine with 16GB of memory, but if it does there sure is little room to grow.&lt;/p&gt;
&lt;p&gt;Maybe you should pack your BOOL values as single bits, which will obviously require a bit of fun with bitwise operators and translating "bit addresses" to byte+bit parts. You would increase your density by a factor of 32 or 64, which should easily fit in your available memory&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>"Out of global data memory". Is there a way to increase the memory?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/33f78c733f/?limit=25#2493" rel="alternate"/><published>2022-03-25T20:44:01.392000Z</published><updated>2022-03-25T20:44:01.392000Z</updated><author><name>leandroct</name><uri>https://forge.codesys.com/u/leandroct/</uri></author><id>https://forge.codesys.comd5b6f8e6270130ef9901b8ade97c7ffa84a95526</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I use Codesys Control Win MC 3.5 SP16 and I created in my existing application two new arrays of &lt;span&gt;[600,3000,650]&lt;/span&gt; OF BOOL. When I try to download the application, if shows up an error message "Out of global data memory. I tried clean all and retried the download with no sucess and I deleted persistent varibales too. Is there a way to increase the memory? My PC has 16Gb of memory and it has memory available. Where I can access the configuration to chance this? Thanks!&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>