After working with GxWorks3 on several projects, I learned a few things about managing memory that were very helpful. I hope my tips on the following topics will help others as well when working with GxWorks3.
- How to set up retained memory for local labels, global labels with no device assignment, and global labels with device assignment
- Adjusting the allotted device memory if you run out of a certain type of device memory
- Minimizing program memory
Retained Memory
It is straightforward to set non-device assigned labels such as local labels within a program or a global label that doesn’t have a device assignment to retain memory. Locate the label and within the class drop down select ‘VAR_RETAIN’ or ‘VAR_GLOBAL_RETAIN’ as shown below for the two types of labels.


It takes a couple of extra steps to set a device assigned global label to retain. After you have decided on which device you want to use to assign to your label, you can assign the device to the label as normal, then select ‘VAR_GLOBAL_RETAIN.’
In the example below, I have assigned a trend array to a device section starting at D12000 up to D12399.

Next, the D memory registers D12000-D12399 must be designated as retain memory in the ‘Device/Label Memory Area Detailed Setting’ area. To navigate here using the navigation tree, double-click on ‘Parameter’ -> ‘CPU Parameter’ -> ‘Memory/Device Setting’ -> ‘Device/Label Memory Area Setting’ -> ‘<Detailed Settings>.’

This will display the window shown below.

From here, double-click on any of the cells circled in the screenshot above. This will open the Latch Range Setting, where we will set what memory registers should be retained or latched.

Here, we can see that I have a couple of ranges set for both M and D registers including the range D12000-D12999 to include the trend array from our example. After you have set the ranges you need for your project, press ‘OK’ and then you are done.
Note, if you assign global labels that are not set to retain registers you defined in the Latch Range Setting or vice versa, you will receive a compile error reminding you to correct this.

Adjusting Device Memory Allotment Size
Depending on the size of your PLC memory and the size of your project, there are times when you might run out of a particular device type. In this situation, if you are unable to upgrade your PLC memory, you can attempt to reallocate your device types if there are some device memory types that you are not using.
To do this, navigate to the Device/Label Memory Area Setting Detail Settings screen as mentioned in the section above. Starting in the navigation tree, double-click on ‘Parameter’ -> ‘CPU Parameter’ -> ‘Memory/Device Setting’ -> ‘Device/Label Memory Area Setting’ -> ‘<Detailed Settings>.’

Under the Device/Points column is where you can see the amount of points allocated to a given device. For example, for the D device, there are 20k points allocated which means the range of usable D devices spans from D0 – D20000. You can modify these allocations as needed as long as the total adds up to the ‘Total Device’ at the bottom as that is the limit of the PLC. After you are done, click on the ‘Check’ button at the bottom to verify that your new allocations are ok.
Minimizing Program Memory

The screenshot above was from a previous Mitsubishi GxWorks3 PLC project where we almost ran out of program memory. Since upgrading the PLC memory was not an option, we had to consider other ways to save memory.
For this project, we were programming from scratch and adhering to DMC’s best practices by using named Global Labels and UDTs for maximum code clarity and ease of maintenance. However, we discovered that moving data directly between UDTs using its symbolic name used a lot of program memory compared to directly manipulating the data using its device memory address. In the screenshots below you can see the massive difference in program steps used between using the symbolic name vs. the direct device address in rung 17.


Due to the project hardware constraints, we had to sacrifice some code readability to fit the entire program within the allotted memory available. We used the instructions, BMOV (Transferring 16 – bit block data) and BLKMOV (Transferring n-bit data) on some of the bigger data transfers to help us achieve this. In the end, we were able to fit our program onto the PLC.
I hope that you find these tips for setting up retained memory, adjusting the allotted device memory, and minimizing program memory helpful when working with GxWorks3.
Contact us today to learn more about our Mitsubishi PLC expertise and how we can help your team achieve its goals.







