## 1 Introduction  
### Background  
The continuous development of the Industrial Internet of Things (IIoT) has greatly improved industrial efficiency. Nowadays, with the continuous growth of IoT networks, cloud computing has become crucial as an optimal way to handle big data processing and complex computation for practical applications. However, cloud computing faces bottlenecks due to the large amount of data generated by advanced IoT applications and the need for fast response time [1]. Processing the large volume of real-time data collected from IIoT terminal devices can lead to high server latency. This can make traditional cloud computing architectures inadequate in meeting the speed requirements of the IIoT [2]. Taking smart cities as an example, with the increasing amount of edge data and the growing demand for encryption, it has been shown that large-scale centralized server clusters in cloud computing are insufficient to meet the needs of rapidly expanding intelligent IoT systems [3]. To address this issue, edge computing has emerged as a new paradigm. Over the past decade, edge computing has grown in popularity and is expected to continue growing in the coming years [4]. However, as edge computing continues to grow, it faces challenges such as search efficiency, reliability requirements, and resource allocation [5]. As edge computing-based solutions rapidly proliferate, many edge computing applications utilize the cloud for data processing and analysis. However, latency-sensitive applications with low-latency requirements and high bandwidth consumption can be inefficient and costly when processed through cloud servers [6]. Thus, edge computing involves deploying distributed computing resources at the network edge [7]. Before the popularization of edge computing, the emergence of a large number of mobile devices led to extremely high network latency [8]. Nowadays, by offloading computation to nearby edge nodes with sufficient computing capabilities, terminal devices can receive timely responses to meet user demands [9]. As a traditional industrial controller, the Programmable Logic Controller (PLC) plays a critical role in industrial processes. Traditional PLCs are primarily responsible for performing simple tasks such as real-time control and data collection, with most data processing being carried out on industrial servers or in the cloud. PLCs themselves perform minimal computing tasks. However, with the current edge computing paradigm and the influx of large amounts of field data and more complex new applications [10], PLCs are beginning to require more powerful computing capabilities. Therefore, PLCs are gradually evolving into edge PLCs [11].The emergence of edge PLCs has effectively enhanced productivity in industrial automation processes [12]. As shown in Figure 1, edge PLCs act as edge nodes close to the data source, performing tasks such as executing control commands and processing data, thus avoiding the high costs of centralized servers. Previous edge PLCs used a static memory allocation scheme internally, which resulted in low memory utilization and slow processing speeds when handling increasing amounts of edge data. Therefore, a more efficient dynamic memory allocation method is needed to ensure real-time performance and task processing efficiency [13]. By analyzing the working environment of edge PLCs, we can devise a better allocation strategy to maximize the utilization of memory resources within edge PLCs and improve task processing efficiency. In real-world edge PLC production environments, non-real-time tasks often coexist with real-time tasks. In order to ensure real-time performance while maximizing the processing efficiency of non-real-time tasks, we adopt an improved fixed-size allocation algorithm for allocating memory to real-time tasks. At the same time, we model the memory allocation problem of non-real-time tasks as a special knapsack problem and apply a dynamic programming algorithm to find the optimal memory allocation strategy. Figure 1: Edge PLC in edge computing architecture.