WO2010082604A1 - Data processing device, method of memory management, and memory management program - Google Patents

Data processing device, method of memory management, and memory management program Download PDF

Info

Publication number
WO2010082604A1
WO2010082604A1 PCT/JP2010/050349 JP2010050349W WO2010082604A1 WO 2010082604 A1 WO2010082604 A1 WO 2010082604A1 JP 2010050349 W JP2010050349 W JP 2010050349W WO 2010082604 A1 WO2010082604 A1 WO 2010082604A1
Authority
WO
WIPO (PCT)
Prior art keywords
storage area
fixed
data
area
length
Prior art date
Application number
PCT/JP2010/050349
Other languages
French (fr)
Japanese (ja)
Inventor
雅規 上久保
Original Assignee
日本電気株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 日本電気株式会社 filed Critical 日本電気株式会社
Priority to JP2010546643A priority Critical patent/JPWO2010082604A1/en
Publication of WO2010082604A1 publication Critical patent/WO2010082604A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation

Definitions

  • the present invention relates to a technology for securing and releasing a data storage area in dynamic memory management on a data processing device, and in particular, securing and releasing an area for temporarily storing a communication frame on a memory of a communication device. Regarding technology.
  • a data processing apparatus that performs software processing using a processor and a memory needs a mechanism for managing a data storage area on the memory.
  • This method of managing the data storage area on the memory can be classified according to the memory securing procedure, and can be considered in three ways: static memory management, automatic memory management, and dynamic memory management.
  • Static memory management is a method of allocating data areas at the stage of compiling a program before system startup.
  • the allocation of the data storage area is not changed while the program is operating on the system.
  • the merit of the static memory management method is that the memory management during operation is unnecessary, so the memory management load by the processor is very light. Since it cannot be deleted, it is suitable for holding system variables, but it is not suitable for storing user variables and data.
  • Automatic memory management is a method for securing and releasing memory areas on the call stack.
  • the call stack is generated as an automatic variable area used in the function when the function call is executed, and is discarded when the function execution ends. Since it is not necessary to explicitly secure and release the area at the user level, the area is discarded when the function execution ends, and a memory leak due to the area release omission is less likely to occur.
  • Dynamic memory management is a memory management method in which a user explicitly secures or releases a memory area on an unused memory area called a heap area.
  • a heap area In the dynamic memory management method, an explicit data area is secured at an arbitrary timing during program execution, and the secured data area is held on the heap area until an explicit release operation is executed from the program. Is done.
  • dynamic memory management is often performed in a memory that temporarily stores communication frames in a communication device.
  • variable-length allocation There are two methods for determining the size of each data storage area when performing dynamic memory management: fixed-length allocation and variable-length allocation.
  • fixed-length allocation the heap area is divided into two or more fixed-length blocks of the same size, and the use and non-use are managed in accordance with a request for securing a memory area by a program in units of the fixed-length block.
  • variable length allocation is a method of securing a data area by cutting it out from the heap area in accordance with the size required by the program.
  • variable-length allocation is an allocation method that attempts to secure only the area required for data storage from the heap area, and therefore, an unused area is generated for the area allocated to each data. Hateful. However, when securing and releasing the data storage area are repeated to some extent, unequal length free areas called fragments are scattered, and the next time the data storage area is to be secured, the process for searching for an appropriate free area is performed. It tends to be complicated. Further, even if there is a sufficient difference between the total heap size and the total used area, if each free area is small, a state where a new data storage area cannot be secured may occur.
  • variable-length allocation is often used in systems that are relatively versatile and have sufficient processing capacity of the processor.
  • a device such as a communication processing device, it is necessary to suppress the processing capacity of the processor as much as possible from the viewpoint of cost reduction, and there is a tendency to use a fixed length allocation that can relatively suppress the amount of processing for memory management by the processor.
  • Patent Document 1 describes a memory management method using a fixed-length heap area, although the target is an image forming apparatus. Specifically, in the memory area management method disclosed in Patent Document 1, when a plurality of fixed-length heap areas are used to secure a plurality of fixed-size areas in advance and the area is insufficient When a part of the variable-length heap area is used as a fixed-length area, and the size and number of data to be stored in the heap area at a certain time can be estimated in advance using these blocks, A fixed-length allocation that manages a plurality of data storage areas of the same size side by side simultaneously achieves high memory usage efficiency and low processing load.
  • Patent Document 2 describes a dynamic memory management method using variable length allocation. Specifically, in the memory area management method disclosed in Patent Document 2, a memory pool that is a heap area is divided in advance into a plurality of areas called sub-pools, and data storage is performed when a data storage area is secured. The search time is shortened by changing the order in which a plurality of subpools are searched for each required size. Patent Document 2 states that as the allocation is repeated, a data storage area of the same size is easily assigned to a predetermined address, and an optimum empty space can be easily obtained at an early stage when searching for the position. .
  • the data size used as the threshold value in each sub-pool size and search pattern is a parameter for which an optimum value should be set in accordance with the size and number of data to be stored during operation.
  • the data size and number distribution are known in advance, it is possible to increase the memory usage efficiency.
  • Japanese Patent Application Laid-Open No. 2003-228561 discloses a technique for dividing a data area of a memory into a plurality of basic blocks, and further subdividing the basic blocks into a plurality of small blocks having an arbitrary size to efficiently use a storage area. Is described.
  • Patent Document 4 describes a technique in which when writing swath data in a buffer, the write pointer is sequentially moved and the swath data is written in the next buffer following the last position of the previous swath data.
  • Patent Document 5 describes a technique of managing writing using a FIFO block register and an EMPTY bit when writing data as a FIFO block in a buffer.
  • the total amount of communication frames being processed by the communication device at a certain time is determined to be almost constant from the maximum communication bandwidth and the residence time of the communication frame according to the specifications.
  • the size of each communication frame is variable, and the number of communication frames that must be temporarily stored is not constant. The reason is that each application on the upper layer of the communication protocol transmits / receives an optimal communication frame.
  • communication frames of different sizes and average bandwidths are sent and received within the logical channel used by the connection established by each application. Because it is.
  • the memory device capacity that must be physically prepared is constant even if the characteristics of the logical channel change. If the heap size to be prepared varies greatly depending on the communication conditions, a memory device must be prepared for the maximum variation, which is disadvantageous in terms of cost when considering the average usage state. is there.
  • An object of the present invention is a data processing apparatus that temporarily stores data such as communication frames in a memory and processes the data, and the data that makes it possible to increase the memory use efficiency and reduce the apparatus cost with a small number of processor resources.
  • a processing device, a memory management method, and a memory management program are provided.
  • a data processing apparatus is a data processing apparatus including a unit that temporarily stores and processes variable-length data in a heap area on a memory.
  • a fixed-length block management unit that allocates and releases fixed-length blocks and a data storage area management unit that secures and releases storage areas for storing variable-length data in fixed-length blocks.
  • the data storage area management unit is fixed A reference counter holding module that holds the number of storage areas for each long block, a free area pointer holding module that holds address information indicating the end of the storage area, and a storage area for variable-length data in this address information order and release. And a data storage area setting module.
  • a memory management method is a data processing apparatus including a unit that temporarily stores and processes variable-length data in a heap area on a memory, and is variable on the memory.
  • a memory management method for securing a storage area for storing long data wherein the data storage area setting module reads address information indicating the end of the storage area from the free area pointer holding module, and the data storage area setting module in the order of the address information Sequentially reserve storage areas for variable length data, and the data storage area setting module stores variable length data in the reserved storage areas.
  • a memory management program is a data processing apparatus having a unit for temporarily storing and processing variable length data in a heap area on a memory, and holding a free area pointer.
  • the data storage area setting module causes the computer to execute a function of storing variable length data.
  • the present invention is configured to secure a new data storage area following the address indicated by the free area pointer in the memory area as described above, the data storage area can be secured with a small amount of calculation that does not place a heavy load on the processor. Can be arranged close to one direction in the order of time, and it is difficult to generate a fragment state. Therefore, it is possible to increase the memory usage efficiency and reduce the apparatus cost with a small number of processor resources.
  • FIG. 2 is an explanatory diagram illustrating a configuration of a storage area on a RAM (Random Access Memory) illustrated in FIG. 1.
  • FIG. 2A shows a state where a heap area is secured on the RAM.
  • FIG. 2B shows a state in which the fixed-length block management unit has secured N (N is an integer) fixed-length blocks on the heap area.
  • FIG. 2C shows a state in which the data storage area setting module has secured the data storage area on the fixed-length block.
  • 3 is a flowchart showing an operation when the data storage area management unit shown in FIG. 1 stores new data in a RAM.
  • FIG. 4 is a flowchart showing an operation of securing a new fixed-length block by the fixed-length block management unit shown as step S202 in FIG. 3.
  • FIG. 3 is a flowchart showing an operation in which the fixed-length block management unit and the data storage area management unit shown in FIG. 2 release a data storage area that is no longer needed.
  • FIG. 3 is an explanatory diagram showing time transitions for securing and releasing a data storage area on the RAM shown in FIGS. It is explanatory drawing which shows the structure of the memory area on RAM in the 2nd Embodiment of this invention.
  • FIG. 7A shows a state where a heap area is secured on the RAM.
  • FIG. 7B shows a state in which the fixed-length block management unit has secured N (N is an integer) fixed-length blocks on the heap area.
  • FIG. 7C shows a state where the data storage area setting module secures the data storage area on the fixed-length block.
  • the data processing apparatus is a data processing apparatus that includes a unit (CPU 10) that temporarily stores and processes variable-length data in a memory area (RAM 11).
  • the fixed-length block management unit 12 that allocates and releases 31 to 3N (N is a natural number) and the storage areas 61 to 6M (M is a natural number) that stores variable-length data in the fixed-length blocks 31 to 3N are secured and released.
  • the data storage area management unit 13 includes a reference counter holding module 13a that holds the number of storage areas for each of the fixed-length blocks 31 to 3N, and a free area pointer holding module 13b that holds address information indicating the end of the storage area. And a data storage area setting module 13c for sequentially securing variable length data storage areas 61 to 6M in the order of the address information.
  • the fixed length management unit 12 and the data storage area management unit 13 are constructed on software by the CPU executing a program, and these functions are implemented on the software.
  • the reference counter holding module 13a, the free area pointer holding module 13b, and the data storage area setting module 13c provided in the data storage area management unit 13 are constructed on software by the CPU executing a program. These functions are realized on software.
  • a program for realizing the functions of the fixed length management unit 12 and the data storage area management unit 13, the functions of the reference counter holding module 13a, the free area pointer holding module 13b, and the data storage area setting module 13c on software is a recording medium. And is subject to commercial transactions.
  • the data storage area setting module 13c secures the variable length data storage areas 61 to 6M
  • the value held by the free area pointer holding module 13b is used as the head address and the end of the fixed length block to which the address belongs.
  • a storage area setting function that uses a free area between them as a storage area, and a capacity determination function that determines whether the capacity of the free area is insufficient with respect to the capacity to be secured as the storage area.
  • the fixed-length block management unit 12 has a new allocation function for newly allocating fixed-length blocks 31 to 3N when it is determined that the free space capacity is insufficient.
  • the data storage area setting module 13c when releasing the storage area, checks the reference counters 51 to 5N on the fixed-length block to which the released storage area belongs, and the reference of the storage area. When the counter value is 0 and the address pointed to by the free area pointer 42 does not indicate the fixed-length block, there is an unused block determination function that determines that the fixed-length block is not used.
  • the fixed-length block management unit 12 has an unused block release function that releases the fixed-length block when the data storage area setting module 13c determines that the fixed-length block is not used.
  • an unused area (unused heap area 41) that is not allocated as a fixed-length block in the memory area is managed as a management queue.
  • the variable length data stored in the storage areas 61 to 6M is a communication frame or a communication packet.
  • the memory area is described as a heap area.
  • the present embodiment makes it difficult to generate a fragment state by arranging data storage areas close to each other in the order of time when a data storage area is secured with a small amount of calculation. Therefore, it is possible to increase the memory usage efficiency and reduce the apparatus cost with a small number of processor resources. Hereinafter, this will be described in more detail.
  • FIG. 1 is an explanatory diagram showing the configuration of the communication device 1 according to the first embodiment of the present invention.
  • the communication device 1 includes a processor 10 that controls the operation of the apparatus, a RAM (Random Access Memory) 11 that is one of the devices controlled by the processor 10, and a communication device 14 that transmits and receives communication packets.
  • the communication device 14 includes many devices such as a modulator, an oscillator, a demodulator, an input / output device, etc., but it is not particularly necessary to refer to them in detail in explaining the present invention.
  • the processor 10 When the processor 10 receives the communication packet, the processor 10 temporarily writes the data of the packet in the RAM 11, performs processing on the packet by the communication device 14, and erases the packet when the processing is completed.
  • the processor 10 writes data to the RAM 11, the data to be stored and the address to store the data are transmitted to the RAM 11.
  • a read command and a read source address are transmitted to the RAM 11.
  • a fixed-length block management unit 12 that secures and releases a fixed-length block (to be described later) on the RAM 11 and a data storage area management unit 13 that secures and releases a data storage area on the fixed-length block. And operate on software.
  • the fixed-length block management unit 12 and the data storage area management unit 13 perform all operations related to securing and releasing the storage area described below based on the functions of the processor 10 and the OS (operation system, not shown). be able to.
  • the data storage area management unit 13 further holds a reference counter holding module 13a that holds the number of storage areas (reference counter value) for each fixed-length block, and address information (free area pointer 42) indicating the end of the storage area.
  • the function module is divided into an empty area pointer holding module 13b and a data storage area setting module 13c that sequentially reserves variable length data storage areas in the order of address information indicated by the empty area pointer 42.
  • FIG. 2 is an explanatory diagram showing the configuration of the storage area on the RAM 11 shown in FIG.
  • FIG. 2A shows a state in which the heap area 21 is secured on the RAM 11.
  • FIG. 2B shows a state in which the fixed-length block management unit 12 has secured N fixed-length blocks 31 to 3N (N is an integer) on the heap area 21. An area other than the fixed-length blocks 31 to 3N becomes an unused heap area 41.
  • FIG. 2C shows a state in which the data storage area setting module 13c secures the data storage areas 61 to 6M (M is an integer) on the fixed-length blocks 31 to 3N. Due to communication specifications, the data length of each of the data storage areas 61 to 6M is variable.
  • the area indicated by “K” in FIG. 2C and hatched with diagonal lines represents the reserved data storage areas 61 to 6M.
  • the unused heap area 41 is managed by the fixed-length block management unit 12 using a queue (FIFO, first-in first-out) method. In that sense, the unused heap area 41 may be referred to as an unused queue.
  • FIFO first-in first-out
  • the reference counter holding module 13a holds reference counters 51 to 5N corresponding to the fixed-length blocks 31 to 3N.
  • the values of the reference counters 51 to 5N are stored at the heads of the fixed-length blocks 31 to 3N in FIG. 2, the values of all the reference counters 51 to 5N are collected in one place and managed centrally. It may be.
  • the reference counters 51 to 5N indicate the number of data storage areas newly secured by the reference counter holding module 13a as the value for which the data storage areas 61 to 6M are secured. Is incremented (added).
  • the values of the reference counters 51 to 5N of the fixed-length blocks 31 to 3N from which the data storage areas 61 to 6M are released are released by the reference counter holding module 13a. It is decremented (subtracted) by the number of data storage areas.
  • the fixed-length blocks 31 to 3N are areas secured on the heap area 21 by the fixed-length block management unit 12, respectively.
  • the fixed-length blocks 31 to 3N do not necessarily have to be secured adjacent to each other and do not necessarily have to be arranged in the order of addresses. However, if the address at the end of the block can be easily obtained by calculation, the processing load on the processor 10 can be reduced.
  • the fixed-length block management unit 12 manages the unused heap area 41 by a queue (FIFO, first-in first-out) method, assigns a new fixed-length block from among them, and is no longer used in the fixed-length blocks 31 to 3N Can be released and returned to the unused heap area 41.
  • a queue FIFO, first-in first-out
  • the values of the reference counters 51 to 5N are stored at the heads of the fixed-length blocks 31 to 3N by the reference counter holding module 13a.
  • the reference counter corresponding to this fixed-length block is initialized to 0.
  • the reference counter holding module 13a increments (adds) the value of the reference counter corresponding to this fixed-length block.
  • the reference counter holding module 13a decrements (subtracts) the value of the reference counter corresponding to this fixed-length block.
  • the empty area pointer holding module 13b holds an empty area pointer 42 indicating the end address of the area where the data storage areas 61 to 6M are secured.
  • the data storage area setting module 13c starts with the address value pointed to by the free area pointer 42, and the fixed length block to which the free area pointer 42 and the address of the free area pointer belong.
  • an attempt is made to secure an area in an empty area between the end of the. If a data storage area having a required capacity cannot be secured in the meantime, the data storage area setting module 13c notifies the fixed-length block management unit 12 and reserves a new fixed-length block from the unused heap area 41. In this case, a new data storage area is secured.
  • the fixed length block management unit 12 becomes 0.
  • the fixed-length blocks 31 to 3N corresponding to the reference counters 51 to 5N are released and returned to the unused heap area 41.
  • the information indicating the released area is not retained, and the data storage area once released is re-used until the same area is secured as the fixed-length block after the fixed-length block is released once. It is never used.
  • FIG. 3 is a flowchart showing an operation when the data storage area management unit 13 shown in FIG. 2 stores new data on the RAM 11.
  • the data storage area setting module 13c first checks whether or not the data to be stored can be stored in the area indicated by the empty area pointer 42 as the head address (step S201). If there is not enough space to store the data in the area between the free area pointer 42 and the end of the area, the fixed-length block management unit 12 is allocated a new fixed-length block (step S202).
  • the data storage area setting module 13c secures an empty area for the new data, and the empty area pointer holding module 13b moves the empty area pointer by the amount of the new data (step S203).
  • the setting module 13c adds +1 to the reference counter for the fixed-length block (increment) (step S204).
  • FIG. 4 is a flowchart showing the operation of the fixed-length block management unit 12 for securing a new fixed-length block shown as step S202 in FIG.
  • the fixed-length block management unit 12 secures one of the fixed-length blocks from the unused heap area 41 (step S301), and rewrites the free area pointer 42 with the start address of the secured fixed-length block (step S302). ).
  • the reference counter holding module 13a initializes the value of the reference counter corresponding to the fixed-length block as 0 (step S303).
  • FIG. 5 is a flowchart showing an operation in which the fixed-length block management unit 12 and the data storage area management unit 13 shown in FIG. 2 release an unnecessary data storage area.
  • the reference counter holding module 13a decrements (decrements) the reference counter corresponding to the corresponding fixed-length block (step S401).
  • step S402 If the value of the reference counter is 0 (step S402), it is further determined whether or not the area in the fixed-length block indicated by the empty area pointer 42 by the empty area pointer holding module 13b is indicated (step S403). . When the value of the reference counter is 0 and the free area pointer 42 is not in the fixed-length block, the fixed-length block is not used, and there is no data storage area in the fixed-length block. Therefore, the fixed-length block management unit 12 returns the fixed-length block to the unused heap area 41 and releases the fixed-length block (step S404).
  • FIG. 6 is an explanatory diagram showing the time transition of securing and releasing the data storage area on the RAM 11 shown in FIGS.
  • the processor 10 receives the leading communication frame pkt # 1 from this state, the fixed-length block management unit 12 first secures the fixed-length block 31 on the unused heap area 41 on the RAM 11 (FIG. 3: steps S201 to 202). .
  • the reference counter 51 corresponding to the fixed-length block 31 is also secured and set to the initial value 0 (FIG. 4: steps S301 to 302).
  • the data storage area setting module 13c of the data storage area management unit 13 secures the data storage area 61 of the communication frame pkt # 1 on the fixed-length block 31, and simultaneously stores the data of pkt # 1 therein. Then, the free area pointer 42 moves by that capacity (FIG. 3: step S203). In accordance with this, the value of the reference counter 51 corresponding to the fixed length block 31 is also incremented by 1 in the reference counter holding module 13a (FIG. 3: step S204). Thus, the state shown in step S501 of FIG. 6 is obtained.
  • the data storage area setting module 13c similarly secures the data storage areas 62 to 63 corresponding to these and stores these data, and the free area
  • the pointer holding module 13b moves the empty area pointer 42 (FIG. 3: step S203), and each time the reference counter holding module 13a increments the value of the reference counter 51 by 1 (FIG. 3: step S204).
  • step S504 of FIG. 6 the state shown in step S504 of FIG. 6 is obtained.
  • step S203 the free area pointer holding module 13b moves the free area pointer 42 to the free area that follows pkt # 3, and the data storage area setting module 13c enters this area.
  • a data storage area 64 is secured to store these data (FIG. 3: step S203), and the reference counter holding module 13a adds the value of the reference counter 51 correspondingly (FIG. 3: step S204).
  • the fixed-length block management unit 12 secures a new fixed-length block 32 on the RAM 11 (FIG. 3: steps S201 to 202), and the reference corresponding to the fixed-length block 32 is stored.
  • the counter 52 is secured and set to an initial value 0 (FIG. 4: steps S301 to S302).
  • the data storage area setting module 13c secures the data storage area 65 of the communication frame pkt # 5 on the fixed-length block 32 and stores these data, and the free area pointer holding module 13b moves the free area pointer 42.
  • the reference counter holding module 13a adds 1 to the value of the reference counter 52 corresponding to the fixed length block 32 (FIG. 3: step S204).
  • the data storage area setting module 13c releases these data storage areas, and the reference counter holding module 13a refers to them.
  • the value of the counter 51 is subtracted (FIG. 5: Step S401)
  • the value becomes 0 (FIG. 5: Step S402)
  • the empty area pointer 42 points to the fixed length block 32 (FIG. 5: Step S403).
  • the fixed-length block management unit 12 releases the fixed-length block 31 and returns it to the unused heap area 41 (FIG. 5: Step S404).
  • the state shown in step S507 of FIG. 6 is obtained.
  • the data storage area setting module 13c stores this pkt # 6 in the data storage area 66 subsequent to pkt # 5 on the fixed length block 32, and is referred to accordingly.
  • the counter holding module 13a adds the value of the reference counter 52 (FIG. 3: steps S203 to 204). Thus, the state shown in step S508 of FIG. 6 is obtained. Thereafter, the same processing is repeated.
  • the operation according to this embodiment is a data processing apparatus including a unit that temporarily stores and processes variable length data in the heap area 21 on the memory 11, and stores the variable length data on the memory 11.
  • a memory management method for securing storage areas 61 to 6M (M is a natural number), in which the data storage area setting module reads address information indicating the end of the storage areas 61 to 6M from the free area pointer holding module, and free area pointer 42
  • the data storage area setting module 13c sequentially secures the variable length data storage areas 61 to 6M in the order of the address information indicated by the data storage area 61 to 6M, and the data storage area setting module 13c stores the variable length data in the reserved storage areas 61 to 6M.
  • the data storage area setting module 13c secures the variable length data storage areas 61 to 6M, the fixed length block to which the address belongs, starting from the value indicated by the empty area pointer 42 held by the empty area pointer holding module 13b.
  • the free area between 31 and 3N is defined as storage areas 61 to 6M (FIG. 3: step S203), and the capacity of the free area is insufficient for the capacity to be secured as the storage areas 61 to 6M.
  • a storage area is secured on the fixed-length block newly allocated by the fixed-length block management unit 12 (FIG. 3: steps S202 to 203).
  • the data storage area setting module 13c When the data storage area setting module 13c releases the storage area, the data storage area setting module 13c checks the number of storage areas on the fixed-length blocks 31 to 3N to which the released storage areas 61 to 6M belong (see FIG. 4: Step S401-2), if the value of the reference counters 51-5N of the storage area is 0 and the address held by the free area pointer 42 does not indicate the fixed-length block, the fixed-length block management unit 12 The fixed-length block is released (FIG. 4: steps S402 to S4).
  • each of the above-described operation steps may be programmed to be executable by a computer, and these may be executed by the CPU 10 which is a main body that directly executes each of the steps.
  • this embodiment has the following effects.
  • This embodiment is premised on the characteristics of communication data that are “processed almost in the order of arrival” and the characteristics that “the lifetime of data is almost equal”.
  • the next data storage area is continuously secured immediately after the data area secured immediately before.
  • Data stored in the data storage area in the fixed-length block is arranged in the order of arrival.
  • these data storage areas continuously hold data whose lifetimes are close to each other.
  • the data storage areas are released in the oldest order, so that the continuity of the data storage area is maintained, and it is difficult for a fragmentation state in which fragments of free areas are scattered. Therefore, the memory usage efficiency can be increased.
  • the data storage area is continuously secured in the fixed-length block, the time during which either the fixed-length block can be used efficiently or unused can be increased. Even if this state exists, the data area is continuously released within a short time, so that the state changes to an unused state.
  • the maximum total amount of communication frames that must be held at a certain time is determined.
  • the resource amount of the RAM 11 that must be physically prepared may be ensured in accordance with the maximum total communication frame amount. That is, according to the present embodiment, it is possible to accurately estimate the required amount of memory device resources.
  • the second embodiment of the present invention is the same as the first embodiment described with reference to FIGS. 1 to 6 in terms of the network and hardware configurations, and the general software configuration.
  • the second embodiment differs from the first embodiment described above in that the fixed-length block management unit 12 allocates and releases fixed-length blocks for each of a plurality of logical channels set according to the lifetime of variable-length data.
  • the free area pointer holding module 13b holds the free area pointers 71 to 7K one by one for each logical channel.
  • FIG. 7 is an explanatory diagram showing the configuration of the storage area on the RAM 11 in the second embodiment of the present invention.
  • FIG. 7A shows a state where the heap area 21 is secured on the RAM 11.
  • FIG. 7B shows a state in which the fixed-length block management unit 12 has secured N fixed-length blocks 31 to 3N (N is an integer) on the heap area 21.
  • An area other than the fixed-length blocks 31 to 3N becomes an unused heap area 41.
  • FIG. 7C shows a state in which the data storage area setting module 13c has secured the data storage areas 61 to 6M (M is an integer) on the fixed-length blocks 31 to 3N.
  • Areas hatched with diagonal lines denoted as “K1” and “K2” in FIG. 7C represent reserved data storage areas 61 to 6M. “K1” represents logical channel # 1, and “K2” represents logical channel # 2.
  • K logical channels (K is an integer) are prepared in N fixed-length blocks 31 to 3N (N is an integer) on the heap area 21, and each of these logical channels is free. Area pointers 71 to 7K are prepared. Except for this point, the configuration is the same as that of the first embodiment shown in FIG.
  • the logical channel is a virtual channel assigned for each application when different communication is performed in the host device, and is a factor that determines the size and the number per time as a feature of the communication frame.
  • the free area pointers 71 to 7K hold candidate addresses for securing new areas for each logical channel. As a result, different fixed-length blocks are used for each logical channel.
  • the free area pointers 71 to 7K perform the same operation as the free area pointer 42 in the first embodiment for each logical channel.
  • the data storage area can be secured and released by the same operation as in the first embodiment.
  • the first embodiment it is a premise that the above-described effects can be obtained that all data have substantially the same lifetime.
  • a plurality of data types having different priorities and QoS parameters are set for each of the plurality of applications, and thus different lifetimes may be required for each data type.
  • the same effect as in the first embodiment cannot be obtained if data having different lifetimes are continuous in the data storage areas close to each other.
  • the present invention can be applied to a device including a processor and a RAM controlled by the processor, but exhibits a remarkable effect particularly in a device that handles data types such as communication frames or communication packets as described above. . Therefore, it is suitable for a communication processing apparatus that processes frames and packets in various communication layers. Further, the present invention is also suitable for a device that performs streaming processing and a multimedia processing device that performs codec processing such as video and audio.

Abstract

Disclosed is a data processing device that improves efficiency in memory usage with a scarce processor resource, and reduces device costs. A data processing device (1), comprising a unit that temporarily stores and processes variable length data in a memory region, further comprises fixed length block management unit, which allocates and releases a fixed length block (31 – 3N) of the memory region, and a data storage region management unit (13), which maintains and releases a storage region (61 – 6M), which stores variable length data within the fixed length block, wherein the data storage region management unit further comprises a query counter preservation module (13a), which preserves a storage region quantity on a per fixed length block basis, an empty region pointer preservation module (13b), which preserves address information that denotes an end of a storage region, and a data storage region setting module (13c), which sequentially maintains and releases the fixed length data storage regions in order by the address information.

Description

データ処理装置、メモリ管理方法およびメモリ管理プログラムData processing apparatus, memory management method, and memory management program
 本発明はデータ処理装置上での動的メモリ管理におけるデータ格納領域の確保と解放を実行する技術に関し、特に通信機器のメモリ上における通信フレームを一時的に格納する領域の確保と解放を実行する技術に関する。 The present invention relates to a technology for securing and releasing a data storage area in dynamic memory management on a data processing device, and in particular, securing and releasing an area for temporarily storing a communication frame on a memory of a communication device. Regarding technology.
 プロセッサとメモリを使ってソフトウェア処理を行うデータ処理装置では、メモリ上でデータ格納領域を管理する仕組みが必要である。このメモリ上のデータ格納領域管理の方法はメモリ確保手順によって分類することができ、静的メモリ管理、自動メモリ管理、動的メモリ管理の3通りに分けて考えることができる。 A data processing apparatus that performs software processing using a processor and a memory needs a mechanism for managing a data storage area on the memory. This method of managing the data storage area on the memory can be classified according to the memory securing procedure, and can be considered in three ways: static memory management, automatic memory management, and dynamic memory management.
 静的メモリ管理とは、システムの起動以前のプログラムをコンパイルする段階でデータ領域を割り付ける方法である。前記静的メモリ管理方法では、システム上でプログラムが動作している最中に、前記データ格納領域の割付が変更されることはない。前記静的メモリ管理方法によるメリットとしては、動作中のメモリ管理が不要であるため、プロセッサによるメモリ管理負荷が非常に軽いことが挙げられる反面、システムの起動中に不要になったデータ格納領域を削除することができないため、システム変数を保持するのに適しているが、ユーザ変数やデータの格納には向かない。 Static memory management is a method of allocating data areas at the stage of compiling a program before system startup. In the static memory management method, the allocation of the data storage area is not changed while the program is operating on the system. The merit of the static memory management method is that the memory management during operation is unnecessary, so the memory management load by the processor is very light. Since it cannot be deleted, it is suitable for holding system variables, but it is not suitable for storing user variables and data.
 自動メモリ管理とは、コールスタック上でメモリ領域の確保や解放を行う方法である。コールスタックは、関数コールが実行されたときにその関数内で使用する自動変数領域として生成され、関数実行終了とともに破棄がなされる。ユーザレベルで明示的に領域の確保・解放を行う必要がないため、関数実行終了とともに領域が破棄され、領域解放漏れによるメモリリークが発生しにくい。 Automatic memory management is a method for securing and releasing memory areas on the call stack. The call stack is generated as an automatic variable area used in the function when the function call is executed, and is discarded when the function execution ends. Since it is not necessary to explicitly secure and release the area at the user level, the area is discarded when the function execution ends, and a memory leak due to the area release omission is less likely to occur.
 動的メモリ管理とは、ヒープ領域と呼ばれる未使用メモリ領域上でユーザが明示的にメモリ領域の確保や解放を行うことによるメモリ管理方法である。前記動的メモリ管理方法では、プログラム実行中の任意のタイミングで明示的なデータ領域確保が行われ、確保されたデータ領域はプログラムから明示的に解放操作が実行されるまではヒープ領域上に保持される。特に通信機器で通信フレームを一時的に格納するメモリでは、動的メモリ管理が行われることが多い。 Dynamic memory management is a memory management method in which a user explicitly secures or releases a memory area on an unused memory area called a heap area. In the dynamic memory management method, an explicit data area is secured at an arbitrary timing during program execution, and the secured data area is held on the heap area until an explicit release operation is executed from the program. Is done. In particular, dynamic memory management is often performed in a memory that temporarily stores communication frames in a communication device.
 通信フレームをメモリ上に一時格納する際には、動的メモリ管理によりヒープ領域上に個々の通信フレームに対応した格納領域を確保することになる。これは、通信機器において通信フレームに対して行う処理は通常込み入った処理となることが多く、複数の関数をまたがって処理されるためであるのに加えて、ある時刻に保持する必要のある通信フレーム個数は不定であるためでもある。 When storing communication frames temporarily in the memory, storage areas corresponding to individual communication frames are secured in the heap area by dynamic memory management. This is because the processing performed on a communication frame in a communication device is usually complicated processing, and in addition to being processed across multiple functions, it is necessary to hold communication at a certain time. This is also because the number of frames is indefinite.
 動的メモリ管理を行うにあたって個々のデータ格納領域のサイズを決める方法としては、固定長アロケーションと可変長アロケーションの2通りがある。固定長アロケーションはヒープ領域を同サイズの2以上の固定長ブロックに分け、この固定長ブロック単位でプログラムによるメモリ領域の確保要請に従って使用と不使用の管理を行うものである。それに対して、可変長アロケーションはプログラムが必要とするサイズに合わせてヒープ領域からデータ領域を切り出して確保する方法である。 There are two methods for determining the size of each data storage area when performing dynamic memory management: fixed-length allocation and variable-length allocation. In the fixed-length allocation, the heap area is divided into two or more fixed-length blocks of the same size, and the use and non-use are managed in accordance with a request for securing a memory area by a program in units of the fixed-length block. On the other hand, variable length allocation is a method of securing a data area by cutting it out from the heap area in accordance with the size required by the program.
 メモリ領域の管理にかかる処理負荷の少なさという点では、固定長アロケーションが優れている。これは、空き領域となる固定長ブロックがいずれも同サイズとなるので、どの空き領域を使って次のデータ格納領域を確保するかの探索や判断処理の大部分が簡略化できるためである。そのため、プロセッサの演算能力がコスト要件により制限されている機器などで良く用いられるアロケーション方法である。ただし、予め決められたサイズでしか領域の確保ができないため、固定長領域のサイズから必要なデータ領域のサイズを引いた余り分は使用されない無駄な領域となるので、データが固定長である場合を除き必ずしもメモリ使用効率が高い方式とは言えない。 Fixed length allocation is excellent in terms of low processing load for managing memory areas. This is because most of the fixed-length blocks that become free areas have the same size, so that most of the search and determination processing for determining which free area is used to secure the next data storage area can be simplified. Therefore, this is an allocation method that is often used in devices in which the computing power of the processor is limited by cost requirements. However, since the area can be secured only with a predetermined size, the remainder of subtracting the size of the required data area from the size of the fixed-length area becomes a useless area that is not used, so the data has a fixed length Except for the above, it is not necessarily a method with high memory use efficiency.
 これに対して、可変長アロケーションはヒープ領域の中からデータ格納に必要な領域だけを確保しようとするアロケーション方法であるため、それぞれのデータに割り当てられた領域についての無駄な未使用領域が発生しにくい。ただし、データ格納領域の確保と解放をある程度繰り返すとフラグメントと呼ばれる不等長の空き領域が散在する状態となり、次にデータ格納領域を確保しようとするときには、適切な空き領域を探すための処理が複雑なものとなりやすい。また、総ヒープサイズと総使用領域との差が十分あったとしても、個々の空き領域が小さい場合には、新たなデータ格納領域が確保できない状態が発生しうる。 On the other hand, variable-length allocation is an allocation method that attempts to secure only the area required for data storage from the heap area, and therefore, an unused area is generated for the area allocated to each data. Hateful. However, when securing and releasing the data storage area are repeated to some extent, unequal length free areas called fragments are scattered, and the next time the data storage area is to be secured, the process for searching for an appropriate free area is performed. It tends to be complicated. Further, even if there is a sufficient difference between the total heap size and the total used area, if each free area is small, a state where a new data storage area cannot be secured may occur.
 このため、可変長アロケーションは、比較的汎用性が高く、プロセッサの処理能力に余裕があるシステムにおいて使用されることが多い。通信処理機器などの機器においては、コスト削減の観点からプロセッサの処理能力を極力抑える必要があり、プロセッサによるメモリ管理のための処理量が相対的に抑制できる固定長アロケーションが用いられる傾向にある。 For this reason, variable-length allocation is often used in systems that are relatively versatile and have sufficient processing capacity of the processor. In a device such as a communication processing device, it is necessary to suppress the processing capacity of the processor as much as possible from the viewpoint of cost reduction, and there is a tendency to use a fixed length allocation that can relatively suppress the amount of processing for memory management by the processor.
 特許文献1には、その対象が画像形成装置であるが、固定長ヒープ領域を用いたメモリ管理方法が記載されている。具体的には特許文献1に開示されたメモリ領域の管理方法では、複数の固定長ヒープ領域を用いて予め複数のサイズの固定長領域を確保しておくブロックと、それで領域が不足した場合に可変長ヒープ領域の一部を固定長領域として使用するブロックとを備え、これらのブロックを用いて、ある時刻にヒープ領域に格納すべきデータのサイズと個数が予めほぼ予測できるときには、このような同サイズのデータ格納領域を複数並べて管理する固定長アロケーションによって高いメモリ使用効率と低い処理負荷とを同時に実現している。 Patent Document 1 describes a memory management method using a fixed-length heap area, although the target is an image forming apparatus. Specifically, in the memory area management method disclosed in Patent Document 1, when a plurality of fixed-length heap areas are used to secure a plurality of fixed-size areas in advance and the area is insufficient When a part of the variable-length heap area is used as a fixed-length area, and the size and number of data to be stored in the heap area at a certain time can be estimated in advance using these blocks, A fixed-length allocation that manages a plurality of data storage areas of the same size side by side simultaneously achieves high memory usage efficiency and low processing load.
 特許文献2には、可変長アロケーションを用いた動的メモリ管理方法が記載されている。具体的には特許文献2に開示されたメモリ領域の管理方法では、ヒープ領域であるメモリプールをサブプールと呼ばれる複数の領域に予め分割しておき、データ格納領域を確保する際にはデータ格納に必要なサイズ毎にどの順序で複数のサブプールを探すかを変更することで、探索時間の短縮を図っている。特許文献2では、アロケーションを繰り返すに従って同サイズのデータ格納領域が予め決められたアドレスに割り当てられやすくなり、その位置を検索する際に早い段階で最適な空き場所を得られやすくなると述べられている。 Patent Document 2 describes a dynamic memory management method using variable length allocation. Specifically, in the memory area management method disclosed in Patent Document 2, a memory pool that is a heap area is divided in advance into a plurality of areas called sub-pools, and data storage is performed when a data storage area is secured. The search time is shortened by changing the order in which a plurality of subpools are searched for each required size. Patent Document 2 states that as the allocation is repeated, a data storage area of the same size is easily assigned to a predetermined address, and an optimum empty space can be easily obtained at an early stage when searching for the position. .
 つまり、特許文献2では、個々のサブプールサイズと検索パターンで閾値として用いるデータサイズとは、動作中に格納するデータのサイズと個数に合わせて最適値が設定されるべきパラメータであるため、格納するデータのサイズおよび個数の分布が予め詳細にわかっている場合には、メモリ使用効率を上げることが可能となる。 In other words, in Patent Document 2, the data size used as the threshold value in each sub-pool size and search pattern is a parameter for which an optimum value should be set in accordance with the size and number of data to be stored during operation. When the data size and number distribution are known in advance, it is possible to increase the memory usage efficiency.
 また、特許文献3には、メモリのデータ領域を複数の基本ブロックに分割し、さらにそれらの基本ブロックを任意のサイズの複数の小ブロックに細分化して、記憶領域を効率的に使用するという技術が記載されている。特許文献4には、バッファにスワスデータを書き込む際、ライトポインタを順次移動させ、前のスワスデータの最終位置に続けて次のバッファにスワスデータを書き込むという技術が記載されている。特許文献5にはバッファにFIFOブロックとしてデータを書き込む際、この書き込みをFIFOブロックレジスタとEMPTYビットで管理するという技術が記載されている。 Japanese Patent Application Laid-Open No. 2003-228561 discloses a technique for dividing a data area of a memory into a plurality of basic blocks, and further subdividing the basic blocks into a plurality of small blocks having an arbitrary size to efficiently use a storage area. Is described. Patent Document 4 describes a technique in which when writing swath data in a buffer, the write pointer is sequentially moved and the swath data is written in the next buffer following the last position of the previous swath data. Patent Document 5 describes a technique of managing writing using a FIFO block register and an EMPTY bit when writing data as a FIFO block in a buffer.
特開平11-110281号公報Japanese Patent Laid-Open No. 11-110281 特開2003-196152号公報Japanese Patent Laid-Open No. 2003-196152 特開2001-265628号公報JP 2001-265628 A 特開2002-137457号公報JP 2002-137457 A 特開2004-030196号公報JP 2004-030196 A
 コスト要件から実装するメモリデバイスの容量とプロセッサの演算リソース量とを抑える必要があるため、通信機器における通信フレーム格納領域の確保を行う際には、必要なヒープ領域を最小限に抑えてメモリ使用効率を高めつつも同時に動的メモリ管理に必要な処理量を最小限に抑える必要がある。このため、動的メモリ管理においては、固定長アロケーションがもつ低処理負荷の特徴と、動的メモリアロケーションがもつ高いメモリ使用効率とを両立させたい。このためには、データ格納領域をできるだけ確保された時刻順に一方向に近接して配置するようにして、いわゆるフラグメント状態とはしないようにすることが望ましい。 Since it is necessary to reduce the capacity of the memory device to be implemented and the amount of processing resources of the processor due to cost requirements, when securing the communication frame storage area in the communication device, the memory usage is minimized to the necessary heap area. While increasing efficiency, it is necessary to minimize the amount of processing required for dynamic memory management. For this reason, in dynamic memory management, it is desirable to achieve both the low processing load characteristic of fixed-length allocation and the high memory usage efficiency of dynamic memory allocation. For this purpose, it is desirable to arrange the data storage areas as close as possible in one direction in ascending order of time so as not to create a so-called fragment state.
 ある時刻において通信機器で処理中の通信フレームの総量は、最大通信帯域と仕様上の通信フレームの滞留時間からほぼ一定に定まる。しかし、個々の通信フレームのサイズは可変長であり、一時保持しておかなければならない通信フレームの個数も一定ではない。その理由は、通信プロトコル上層のアプリケーションそれぞれにおいて最適な通信フレームにより送受信されるためである。一つの物理通信路上で複数の異なる種類のアプリケーションが同時に通信を行っているとき、それぞれのアプリケーションが確立しているコネクションが利用する論理チャネル内には異なるサイズと平均帯域の通信フレームが送受されているためである。 The total amount of communication frames being processed by the communication device at a certain time is determined to be almost constant from the maximum communication bandwidth and the residence time of the communication frame according to the specifications. However, the size of each communication frame is variable, and the number of communication frames that must be temporarily stored is not constant. The reason is that each application on the upper layer of the communication protocol transmits / receives an optimal communication frame. When multiple different types of applications are communicating at the same time on a single physical communication path, communication frames of different sizes and average bandwidths are sent and received within the logical channel used by the connection established by each application. Because it is.
 予め通信フレームのサイズや帯域が比較的高い確度で予測されている必要がある特許文献1および2に開示されている方法では、このような論理チャネル毎の特性、つまり通信フレームのサイズと個数の組み合わせが異なる複数の論理チャネルを取り扱う通信機器に適用して既述のコスト要件を両立させることは難しい。 In the methods disclosed in Patent Documents 1 and 2 in which the size and bandwidth of a communication frame need to be predicted with a relatively high accuracy in advance, such characteristics for each logical channel, that is, the size and number of communication frames are determined. It is difficult to make the above-mentioned cost requirements compatible by applying to communication equipment that handles a plurality of logical channels with different combinations.
 さらに、論理チャネルの特性が変化しても物理的に用意しなければならないメモリデバイス容量が一定であることが望ましい。もし、用意すべきヒープサイズが通信条件によって大きく変わるような場合には、最大ばらつき時に合わせてメモリデバイスを用意しなければならず、平均的な使用状態を考えるとコスト的に不利になるためである。 Furthermore, it is desirable that the memory device capacity that must be physically prepared is constant even if the characteristics of the logical channel change. If the heap size to be prepared varies greatly depending on the communication conditions, a memory device must be prepared for the maximum variation, which is disadvantageous in terms of cost when considering the average usage state. is there.
 特許文献1による方法では、予め用意されている個々の固定長ヒープ領域に対して実際の処理中に扱う通信フレームサイズに偏りが生じた場合には、使われない固定長領域分だけメモリ領域に無駄が生じる。また、これを補うため、可変長ヒープ領域を消費することとなり、可変長ヒープ領域を予め余分に用意しておかなければならず、この面でもコスト的に不利となる。 In the method according to Patent Document 1, when there is a bias in the communication frame size handled during actual processing with respect to individual fixed-length heap areas prepared in advance, only the unused fixed-length area is stored in the memory area. Waste occurs. In order to compensate for this, a variable-length heap area is consumed, and an extra variable-length heap area must be prepared in advance, which is disadvantageous in terms of cost.
 以上で示した特許文献1および2の問題を解決する構成は、特許文献3~5のいずれにも記載されていない。 The configurations that solve the problems of Patent Documents 1 and 2 described above are not described in any of Patent Documents 3 to 5.
 本発明の目的は、通信フレームなどのデータをメモリ上に一時的に格納して処理するデータ処理装置において、少ないプロセッサリソースでメモリの使用効率を高め、装置コストを低減することを可能とするデータ処理装置、メモリ管理方法およびメモリ管理プログラムを提供することにある。 An object of the present invention is a data processing apparatus that temporarily stores data such as communication frames in a memory and processes the data, and the data that makes it possible to increase the memory use efficiency and reduce the apparatus cost with a small number of processor resources. A processing device, a memory management method, and a memory management program are provided.
 上記目的を達成するため、本発明に係るデータ処理装置は、メモリ上のヒープ領域中に可変長データを一時的に格納して処理するユニットを備えたデータ処理装置であって、ヒープ領域中に固定長ブロックを割り当ておよび解放する固定長ブロック管理ユニットと、固定長ブロック中に可変長データを格納する格納領域を確保および解放するデータ格納領域管理ユニットとを備え、データ格納領域管理ユニットが、固定長ブロックごとに格納領域の個数を保持する参照カウンタ保持モジュールと、格納領域の末尾を示すアドレス情報を保持する空き領域ポインタ保持モジュールと、このアドレス情報順に可変長データの格納領域を順次確保および解放するデータ格納領域設定モジュールとを備えることを特徴とする。 In order to achieve the above object, a data processing apparatus according to the present invention is a data processing apparatus including a unit that temporarily stores and processes variable-length data in a heap area on a memory. A fixed-length block management unit that allocates and releases fixed-length blocks and a data storage area management unit that secures and releases storage areas for storing variable-length data in fixed-length blocks. The data storage area management unit is fixed A reference counter holding module that holds the number of storage areas for each long block, a free area pointer holding module that holds address information indicating the end of the storage area, and a storage area for variable-length data in this address information order and release. And a data storage area setting module.
 上記目的を達成するため、本発明に係るメモリ管理方法は、メモリ上のヒープ領域中に可変長データを一時的に格納して処理するユニットを備えたデータ処理装置にあって、メモリ上に可変長データを格納する格納領域を確保するメモリ管理方法であって、空き領域ポインタ保持モジュールからデータ格納領域設定モジュールが格納領域の末尾を示すアドレス情報を読み込み、このアドレス情報の順にデータ格納領域設定モジュールが可変長データの格納領域を順次確保し、確保された格納領域にデータ格納領域設定モジュールが可変長データを格納することを特徴とする。 In order to achieve the above object, a memory management method according to the present invention is a data processing apparatus including a unit that temporarily stores and processes variable-length data in a heap area on a memory, and is variable on the memory. A memory management method for securing a storage area for storing long data, wherein the data storage area setting module reads address information indicating the end of the storage area from the free area pointer holding module, and the data storage area setting module in the order of the address information Sequentially reserve storage areas for variable length data, and the data storage area setting module stores variable length data in the reserved storage areas.
 上記目的を達成するため、本発明に係るメモリ管理プログラムは、メモリ上のヒープ領域中に可変長データを一時的に格納して処理するユニットを備えたデータ処理装置にあって、空き領域ポインタ保持モジュールからデータ格納領域設定モジュールが格納領域の末尾を示すアドレス情報を読み込む機能と、このアドレス情報の順にデータ格納領域設定モジュールが可変長データの格納領域を順次確保する機能と、確保された格納領域にデータ格納領域設定モジュールが可変長データを格納する機能とをコンピュータに実行させることを特徴とする。 To achieve the above object, a memory management program according to the present invention is a data processing apparatus having a unit for temporarily storing and processing variable length data in a heap area on a memory, and holding a free area pointer. A function for the data storage area setting module to read address information indicating the end of the storage area from the module, a function for the data storage area setting module to sequentially secure a storage area for variable-length data in the order of this address information, and a reserved storage area The data storage area setting module causes the computer to execute a function of storing variable length data.
 本発明は、上述したようにメモリ領域に空き領域ポインタの示すアドレスに続けて新規データ格納領域を確保するように構成したので、プロセッサに負荷のかかりにくい少ない計算量で、データ格納領域が確保された時刻順に一方向に近接して配置することができ、フラグメント状態を発生させにくい。従って、少ないプロセッサリソースでメモリの使用効率を高め、装置コストを低減することを可能とすることができる。 Since the present invention is configured to secure a new data storage area following the address indicated by the free area pointer in the memory area as described above, the data storage area can be secured with a small amount of calculation that does not place a heavy load on the processor. Can be arranged close to one direction in the order of time, and it is difficult to generate a fragment state. Therefore, it is possible to increase the memory usage efficiency and reduce the apparatus cost with a small number of processor resources.
本発明の第1の実施形態に係る通信機器の構成を示す説明図である。It is explanatory drawing which shows the structure of the communication apparatus which concerns on the 1st Embodiment of this invention. 図1で示したRAM(Random Access Memory)上の記憶領域の構成を示す説明図である。図2(a)は、RAM上にヒープ領域を確保した状態を示す。図2(b)は、固定長ブロック管理ユニットがヒープ領域上にN個(Nは整数)の固定長ブロックを確保した状態を示す。図2(c)は、固定長ブロック上に、データ格納領域設定モジュールがデータ格納領域を確保した状態を示す。FIG. 2 is an explanatory diagram illustrating a configuration of a storage area on a RAM (Random Access Memory) illustrated in FIG. 1. FIG. 2A shows a state where a heap area is secured on the RAM. FIG. 2B shows a state in which the fixed-length block management unit has secured N (N is an integer) fixed-length blocks on the heap area. FIG. 2C shows a state in which the data storage area setting module has secured the data storage area on the fixed-length block. 図1で示したデータ格納領域管理ユニットが、RAMに新規データを記憶する際の動作を示すフローチャートである。3 is a flowchart showing an operation when the data storage area management unit shown in FIG. 1 stores new data in a RAM. 図3のステップS202として示した、固定長ブロック管理ユニットが新規の固定長ブロックを確保する動作を示すフローチャートである。FIG. 4 is a flowchart showing an operation of securing a new fixed-length block by the fixed-length block management unit shown as step S202 in FIG. 3. 図2で示した固定長ブロック管理ユニットおよびデータ格納領域管理ユニットが、不要になったデータ格納領域を解放する動作を示すフローチャートである。FIG. 3 is a flowchart showing an operation in which the fixed-length block management unit and the data storage area management unit shown in FIG. 2 release a data storage area that is no longer needed. 図1~2で示したRAM上での、データ格納領域の確保と解放の時間遷移を示した説明図である。FIG. 3 is an explanatory diagram showing time transitions for securing and releasing a data storage area on the RAM shown in FIGS. 本発明の第2の実施形態におけるRAM上の記憶領域の構成を示す説明図である。図7(a)は、RAM上にヒープ領域を確保した状態を示す。図7(b)は、固定長ブロック管理ユニットがヒープ領域上にN個(Nは整数)の固定長ブロックを確保した状態を示す。図7(c)は、固定長ブロック上に、データ格納領域設定モジュールがデータ格納領域を確保した状態を示す。It is explanatory drawing which shows the structure of the memory area on RAM in the 2nd Embodiment of this invention. FIG. 7A shows a state where a heap area is secured on the RAM. FIG. 7B shows a state in which the fixed-length block management unit has secured N (N is an integer) fixed-length blocks on the heap area. FIG. 7C shows a state where the data storage area setting module secures the data storage area on the fixed-length block.
(第1の実施形態)
 以下、本発明の実施形態について添付図に基づいて説明する。
 最初に、本実施形態の基本的な内容について説明し、その後でより具体的な内容について説明する。
 本実施形態に係るデータ処理装置は、メモリ領域(RAM11)に可変長データを一時的に格納して処理するユニット(CPU10)を備えたデータ処理装置であって、ヒープ領域中21に固定長ブロック31~3N(Nは自然数)を割り当ておよび解放する固定長ブロック管理ユニット12と、固定長ブロック31~3N中に可変長データを格納する格納領域61~6M(Mは自然数)を確保および解放するデータ格納領域管理ユニット13とを備える。
 そして、データ格納領域管理ユニット13が、固定長ブロック31~3Nごとに格納領域の個数を保持する参照カウンタ保持モジュール13aと、格納領域の末尾を示すアドレス情報を保持する空き領域ポインタ保持モジュール13bと、このアドレス情報順に可変長データの格納領域61~6Mを順次確保するデータ格納領域設定モジュール13cとを備える。なお、前記固定長管理ユニット12及びデータ格納領域管理ユニット13は、CPUがプログラムを実行することによりソフトウェア上で構築されるものであり、これらの機能はソフトウェア上で実現される。また、データ格納領域管理ユニット13が備えている参照カウンタ保持モジュール13a,空き領域ポインタ保持モジュール13b及びデータ格納領域設定モジュール13cは、CPUがプログラムを実行することによりソフトウェア上で構築されるものであり、これらの機能はソフトウェア上で実現される。また、固定長管理ユニット12及びデータ格納領域管理ユニット13の機能、参照カウンタ保持モジュール13a,空き領域ポインタ保持モジュール13b及びデータ格納領域設定モジュール13cの機能をソフトウェア上で実現させるためのプログラムは記録媒体に記録されて商取引の対象となる。
(First embodiment)
Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings.
First, the basic content of the present embodiment will be described, and then more specific content will be described.
The data processing apparatus according to the present embodiment is a data processing apparatus that includes a unit (CPU 10) that temporarily stores and processes variable-length data in a memory area (RAM 11). The fixed-length block management unit 12 that allocates and releases 31 to 3N (N is a natural number) and the storage areas 61 to 6M (M is a natural number) that stores variable-length data in the fixed-length blocks 31 to 3N are secured and released. And a data storage area management unit 13.
The data storage area management unit 13 includes a reference counter holding module 13a that holds the number of storage areas for each of the fixed-length blocks 31 to 3N, and a free area pointer holding module 13b that holds address information indicating the end of the storage area. And a data storage area setting module 13c for sequentially securing variable length data storage areas 61 to 6M in the order of the address information. The fixed length management unit 12 and the data storage area management unit 13 are constructed on software by the CPU executing a program, and these functions are implemented on the software. Further, the reference counter holding module 13a, the free area pointer holding module 13b, and the data storage area setting module 13c provided in the data storage area management unit 13 are constructed on software by the CPU executing a program. These functions are realized on software. A program for realizing the functions of the fixed length management unit 12 and the data storage area management unit 13, the functions of the reference counter holding module 13a, the free area pointer holding module 13b, and the data storage area setting module 13c on software is a recording medium. And is subject to commercial transactions.
 ここで、データ格納領域設定モジュール13cは、可変長データの格納領域61~6Mを確保するに際して、空き領域ポインタ保持モジュール13bが保持する値を先頭アドレスとして当該アドレスが属する固定長ブロックの末尾との間の空き領域を格納領域とする格納領域設定機能と、空き領域の容量が格納領域として確保しようとしている容量に対して不足しているか否かを判断する容量判断機能を有する。そして、固定長ブロック管理ユニット12は、空き領域の容量が不足していると判断された場合に、新たに固定長ブロック31~3Nを割り当てる新規割り当て機能を有する。 Here, when the data storage area setting module 13c secures the variable length data storage areas 61 to 6M, the value held by the free area pointer holding module 13b is used as the head address and the end of the fixed length block to which the address belongs. A storage area setting function that uses a free area between them as a storage area, and a capacity determination function that determines whether the capacity of the free area is insufficient with respect to the capacity to be secured as the storage area. The fixed-length block management unit 12 has a new allocation function for newly allocating fixed-length blocks 31 to 3N when it is determined that the free space capacity is insufficient.
 さらに、データ格納領域設定モジュール13cは、格納領域を解放する際、解放された格納領域が属する固定長ブロック上の参照カウンタ51~5Nの数値をチェックする参照カウンタチェック機能と、該格納領域の参照カウンタの値が0でありかつ空き領域ポインタ42が指し示すアドレスが該固定長ブロックを示していない場合に該固定長ブロックが不使用であると判断する不使用ブロック判断機能を有する。そして、固定長ブロック管理ユニット12は、データ格納領域設定モジュール13cが該固定長ブロックが不使用であると判断された場合に、該固定長ブロックを解放する不使用ブロック解放機能を有する。 Further, the data storage area setting module 13c, when releasing the storage area, checks the reference counters 51 to 5N on the fixed-length block to which the released storage area belongs, and the reference of the storage area. When the counter value is 0 and the address pointed to by the free area pointer 42 does not indicate the fixed-length block, there is an unused block determination function that determines that the fixed-length block is not used. The fixed-length block management unit 12 has an unused block release function that releases the fixed-length block when the data storage area setting module 13c determines that the fixed-length block is not used.
 ここで、メモリ領域で固定長ブロックとして割り当てられていない未使用領域(未使用ヒープ領域41)は、管理キューとして管理される。そして、格納領域61~6Mに格納される可変長データは、通信フレームもしくは通信パケットである。なお、以下の説明では、前記メモリ領域をヒープ領域として説明する。 Here, an unused area (unused heap area 41) that is not allocated as a fixed-length block in the memory area is managed as a management queue. The variable length data stored in the storage areas 61 to 6M is a communication frame or a communication packet. In the following description, the memory area is described as a heap area.
 この構成を備えることにより、本実施形態は、少ない計算量でデータ格納領域を確保された時刻順に一方向に近接して配置して、フラグメント状態を発生させにくくしている。従って、少ないプロセッサリソースでメモリの使用効率を高め、装置コストを低減することを可能とすることができる。
 以下、これをより詳細に説明する。
By providing this configuration, the present embodiment makes it difficult to generate a fragment state by arranging data storage areas close to each other in the order of time when a data storage area is secured with a small amount of calculation. Therefore, it is possible to increase the memory usage efficiency and reduce the apparatus cost with a small number of processor resources.
Hereinafter, this will be described in more detail.
 図1は、本発明の第1の実施形態に係る通信機器1の構成を示す説明図である。通信機器1は、該装置の動作を制御するプロセッサ10と、プロセッサ10によって制御されるデバイスの一つであるRAM(Random Access Memory)11と、通信パケットの送受信を行う通信機器14とを備える。通信機器14は、たとえば変調器、発振器、復調器、入出力装置などのような多くのデバイスを含むが、本発明を説明する上ではそれらについて詳しく言及する必要は特にない。 FIG. 1 is an explanatory diagram showing the configuration of the communication device 1 according to the first embodiment of the present invention. The communication device 1 includes a processor 10 that controls the operation of the apparatus, a RAM (Random Access Memory) 11 that is one of the devices controlled by the processor 10, and a communication device 14 that transmits and receives communication packets. The communication device 14 includes many devices such as a modulator, an oscillator, a demodulator, an input / output device, etc., but it is not particularly necessary to refer to them in detail in explaining the present invention.
 プロセッサ10は、通信パケットを受信するとRAM11に該パケットのデータを一時的に書き込んでから通信機器14によって該パケットに対する処理を行い、処理が終了したら消去する。プロセッサ10がRAM11にデータを書き込む際には、記憶すべきデータと該データを記憶すべきアドレスをRAM11に送信する。RAM11からデータを読み込む際には、読み込み命令と読み込み元のアドレスをRAM11に送信する。 When the processor 10 receives the communication packet, the processor 10 temporarily writes the data of the packet in the RAM 11, performs processing on the packet by the communication device 14, and erases the packet when the processing is completed. When the processor 10 writes data to the RAM 11, the data to be stored and the address to store the data are transmitted to the RAM 11. When reading data from the RAM 11, a read command and a read source address are transmitted to the RAM 11.
 プロセッサ10がプログラムを実行することにより、RAM11上に後述の固定長ブロックを確保および解放する固定長ブロック管理ユニット12と、固定長ブロック上にデータ格納領域を確保および解放するデータ格納領域管理ユニット13とがソフトウェア上で動作する。固定長ブロック管理ユニット12とデータ格納領域管理ユニット13は、以下に説明する記憶領域の確保と解放に係る動作を、全てプロセッサ10とOS(オペレーション・システム、図示せず)の機能に基づいて行うことができる。 When the processor 10 executes the program, a fixed-length block management unit 12 that secures and releases a fixed-length block (to be described later) on the RAM 11 and a data storage area management unit 13 that secures and releases a data storage area on the fixed-length block. And operate on software. The fixed-length block management unit 12 and the data storage area management unit 13 perform all operations related to securing and releasing the storage area described below based on the functions of the processor 10 and the OS (operation system, not shown). be able to.
 データ格納領域管理ユニット13はさらに、固定長ブロックごとに格納領域の個数(参照カウンタの値)を保持する参照カウンタ保持モジュール13aと、格納領域の末尾を示すアドレス情報(空き領域ポインタ42)を保持する空き領域ポインタ保持モジュール13bと、空き領域ポインタ42が指し示すアドレス情報順に可変長データの格納領域を順次確保するデータ格納領域設定モジュール13cという各機能モジュールに分かれる。これらの動作については後述する。 The data storage area management unit 13 further holds a reference counter holding module 13a that holds the number of storage areas (reference counter value) for each fixed-length block, and address information (free area pointer 42) indicating the end of the storage area. The function module is divided into an empty area pointer holding module 13b and a data storage area setting module 13c that sequentially reserves variable length data storage areas in the order of address information indicated by the empty area pointer 42. These operations will be described later.
 図2は、図1で示したRAM11上の記憶領域の構成を示す説明図である。図2(a)は、RAM11上にヒープ領域21を確保した状態を示す。図2(b)は、固定長ブロック管理ユニット12がヒープ領域21上にN個の固定長ブロック31~3N(Nは整数)を確保した状態を示す。固定長ブロック31~3N以外の領域は未使用ヒープ領域41となる。そして図2(c)は、固定長ブロック31~3N上に、データ格納領域設定モジュール13cがデータ格納領域61~6M(Mは整数)を確保した状態を示す。通信の仕様上、各々のデータ格納領域61~6Mのデータ長は可変長である。図2(c)で「K」として表記され、斜線でハッチングされている領域が、確保されているデータ格納領域61~6Mを表す。 FIG. 2 is an explanatory diagram showing the configuration of the storage area on the RAM 11 shown in FIG. FIG. 2A shows a state in which the heap area 21 is secured on the RAM 11. FIG. 2B shows a state in which the fixed-length block management unit 12 has secured N fixed-length blocks 31 to 3N (N is an integer) on the heap area 21. An area other than the fixed-length blocks 31 to 3N becomes an unused heap area 41. FIG. 2C shows a state in which the data storage area setting module 13c secures the data storage areas 61 to 6M (M is an integer) on the fixed-length blocks 31 to 3N. Due to communication specifications, the data length of each of the data storage areas 61 to 6M is variable. The area indicated by “K” in FIG. 2C and hatched with diagonal lines represents the reserved data storage areas 61 to 6M.
 未使用ヒープ領域41は、固定長ブロック管理ユニット12がキュー(FIFO、先入れ先出し)方式で管理する。その意味で、未使用ヒープ領域41を未使用キューと呼ぶことがある。 The unused heap area 41 is managed by the fixed-length block management unit 12 using a queue (FIFO, first-in first-out) method. In that sense, the unused heap area 41 may be referred to as an unused queue.
 またヒープ領域21上には、参照カウンタ保持モジュール13aが固定長ブロック31~3Nの各々に対応する参照カウンタ51~5Nを保持している。参照カウンタ51~5Nの値は、図2では各々の固定長ブロック31~3Nの先頭に記憶されているが、全ての参照カウンタ51~5Nの値を一カ所に集めて集中的に管理するようにしてもよい。 In the heap area 21, the reference counter holding module 13a holds reference counters 51 to 5N corresponding to the fixed-length blocks 31 to 3N. Although the values of the reference counters 51 to 5N are stored at the heads of the fixed-length blocks 31 to 3N in FIG. 2, the values of all the reference counters 51 to 5N are collected in one place and managed centrally. It may be.
 参照カウンタ51~5Nは、データ格納領域61~6Mが確保されるたびに、該データ格納領域61~6Mが確保された値が参照カウンタ保持モジュール13aによって、新たに確保されたデータ格納領域の数だけインクリメント(加算)される。そしてデータ格納領域61~6Mが解放されるたびに、該データ格納領域61~6Mが解放された固定長ブロック31~3Nの参照カウンタ51~5Nの値が参照カウンタ保持モジュール13aによって、解放されたデータ格納領域の数だけデクリメント(減算)される。 Each time the data storage areas 61 to 6M are secured, the reference counters 51 to 5N indicate the number of data storage areas newly secured by the reference counter holding module 13a as the value for which the data storage areas 61 to 6M are secured. Is incremented (added). Each time the data storage areas 61 to 6M are released, the values of the reference counters 51 to 5N of the fixed-length blocks 31 to 3N from which the data storage areas 61 to 6M are released are released by the reference counter holding module 13a. It is decremented (subtracted) by the number of data storage areas.
 固定長ブロック31~3Nは、それぞれ固定長ブロック管理ユニット12によってヒープ領域21上に確保される領域である。固定長ブロック31~3Nは必ずしも隣接して確保される必要はなく、また必ずしもアドレス順に並んでいる必要はない。ただし、ブロック末尾のアドレスを計算によって容易に求められればプロセッサ10の処理負荷を低減できるので、隣接して配置されていることがより望ましい。 The fixed-length blocks 31 to 3N are areas secured on the heap area 21 by the fixed-length block management unit 12, respectively. The fixed-length blocks 31 to 3N do not necessarily have to be secured adjacent to each other and do not necessarily have to be arranged in the order of addresses. However, if the address at the end of the block can be easily obtained by calculation, the processing load on the processor 10 can be reduced.
 固定長ブロック管理ユニット12は未使用ヒープ領域41をキュー(FIFO、先入れ先出し)方式で管理し、その中から新たな固定長ブロックを割り当て、また固定長ブロック31~3Nの中で使用されなくなったものを解放して未使用ヒープ領域41に戻すことができる。 The fixed-length block management unit 12 manages the unused heap area 41 by a queue (FIFO, first-in first-out) method, assigns a new fixed-length block from among them, and is no longer used in the fixed-length blocks 31 to 3N Can be released and returned to the unused heap area 41.
 参照カウンタ51~5Nの値は、参照カウンタ保持モジュール13aによって固定長ブロック31~3Nの各々の先頭に記憶される。新たな固定長ブロックを割り当てられた段階では、この固定長ブロックに対応する参照カウンタは値0に初期化されている。データ格納領域設定モジュール13cが固定長ブロック内にデータ格納領域を確保すると、そのたびに参照カウンタ保持モジュール13aがこの固定長ブロックに対応する参照カウンタの値をインクリメント(加算)する。また、データ格納領域設定モジュール13cがデータ格納領域を解放すると、そのたびに参照カウンタ保持モジュール13aがこの固定長ブロックに対応する参照カウンタの値をデクリメント(減算)する。 The values of the reference counters 51 to 5N are stored at the heads of the fixed-length blocks 31 to 3N by the reference counter holding module 13a. At the stage where a new fixed-length block is assigned, the reference counter corresponding to this fixed-length block is initialized to 0. Each time the data storage area setting module 13c secures a data storage area in the fixed-length block, the reference counter holding module 13a increments (adds) the value of the reference counter corresponding to this fixed-length block. Each time the data storage area setting module 13c releases the data storage area, the reference counter holding module 13a decrements (subtracts) the value of the reference counter corresponding to this fixed-length block.
 空き領域ポインタ保持モジュール13bは、データ格納領域61~6Mが確保された領域の末尾のアドレスを示す空き領域ポインタ42を保持する。データ格納領域が新たに確保される際には、データ格納領域設定モジュール13cはこの空き領域ポインタ42が指し示すアドレスの値を先頭とし、空き領域ポインタ42と該空き領域ポインタのアドレスが属する固定長ブロックの末尾との間の空き領域に、まず領域確保を試みる。その間に必要な容量のデータ格納領域を確保できない場合には、データ格納領域設定モジュール13cは固定長ブロック管理ユニット12にその旨を伝え、未使用ヒープ領域41から新たな固定長ブロックを確保させて、その上に新たなデータ格納領域を確保する。 The empty area pointer holding module 13b holds an empty area pointer 42 indicating the end address of the area where the data storage areas 61 to 6M are secured. When a new data storage area is secured, the data storage area setting module 13c starts with the address value pointed to by the free area pointer 42, and the fixed length block to which the free area pointer 42 and the address of the free area pointer belong. First, an attempt is made to secure an area in an empty area between the end of the. If a data storage area having a required capacity cannot be secured in the meantime, the data storage area setting module 13c notifies the fixed-length block management unit 12 and reserves a new fixed-length block from the unused heap area 41. In this case, a new data storage area is secured.
 データ格納領域設定モジュール13cが固定長ブロック31~3Nの中でデータ格納領域61~6Mを開放し、デクリメントによって参照カウンタ51~5Nの値が0になると、固定長ブロック管理ユニット12は0になった参照カウンタ51~5Nに対応する固定長ブロック31~3Nを解放して未使用ヒープ領域41に戻す。このとき、解放された領域を示す情報は保持されることはなく、一度解放されたデータ格納領域は、一度固定長ブロックが解放されてから再び同じ領域が固定長ブロックとして確保されるまで、再利用されることはない。 When the data storage area setting module 13c releases the data storage areas 61 to 6M in the fixed length blocks 31 to 3N and the value of the reference counters 51 to 5N becomes 0 by decrementing, the fixed length block management unit 12 becomes 0. The fixed-length blocks 31 to 3N corresponding to the reference counters 51 to 5N are released and returned to the unused heap area 41. At this time, the information indicating the released area is not retained, and the data storage area once released is re-used until the same area is secured as the fixed-length block after the fixed-length block is released once. It is never used.
 図3は、図2で示したデータ格納領域管理ユニット13が、RAM11上に新規データを記憶する際の動作を示すフローチャートである。動作を開始すると、まずデータ格納領域設定モジュール13cが、空き領域ポインタ42が先頭アドレスとして指し示す領域に、記憶しようとしているデータが格納可能かどうかを確認する(ステップS201)。空き領域ポインタ42とその領域の末尾との間の領域に、該データを記憶できるだけの容量がない場合には、固定長ブロック管理ユニット12に新規の固定長ブロックを確保させる(ステップS202)。 FIG. 3 is a flowchart showing an operation when the data storage area management unit 13 shown in FIG. 2 stores new data on the RAM 11. When the operation is started, the data storage area setting module 13c first checks whether or not the data to be stored can be stored in the area indicated by the empty area pointer 42 as the head address (step S201). If there is not enough space to store the data in the area between the free area pointer 42 and the end of the area, the fixed-length block management unit 12 is allocated a new fixed-length block (step S202).
 そして、データ格納領域設定モジュール13cがその新規データのために空き領域を確保し、空き領域ポインタ保持モジュール13bが空き領域ポインタを当該新規データの分だけ移動させる(ステップS203)と同時に、データ格納領域設定モジュール13cが当該固定長ブロック用の参照カウンタを+1加算(インクリメント)する(ステップS204)。 Then, the data storage area setting module 13c secures an empty area for the new data, and the empty area pointer holding module 13b moves the empty area pointer by the amount of the new data (step S203). The setting module 13c adds +1 to the reference counter for the fixed-length block (increment) (step S204).
 図4は、図3のステップS202として示した、固定長ブロック管理ユニット12が新規の固定長ブロックを確保する動作を示すフローチャートである。固定長ブロック管理ユニット12はまず、未使用ヒープ領域41の中から固定長ブロックの一つを確保し(ステップS301)、空き領域ポインタ42をこの確保した固定長ブロックの先頭アドレスで書き換える(ステップS302)。さらにこれと同時に、参照カウンタ保持モジュール13aが当該固定長ブロックに対応する参照カウンタの値を0として初期化する(ステップS303)。 FIG. 4 is a flowchart showing the operation of the fixed-length block management unit 12 for securing a new fixed-length block shown as step S202 in FIG. First, the fixed-length block management unit 12 secures one of the fixed-length blocks from the unused heap area 41 (step S301), and rewrites the free area pointer 42 with the start address of the secured fixed-length block (step S302). ). At the same time, the reference counter holding module 13a initializes the value of the reference counter corresponding to the fixed-length block as 0 (step S303).
 図5は、図2で示した固定長ブロック管理ユニット12およびデータ格納領域管理ユニット13が、不要になったデータ格納領域を解放する動作を示すフローチャートである。データ格納領域設定モジュール13cが当該データ格納領域を解放すると同時に、参照カウンタ保持モジュール13aは、該当固定長ブロックに対応する参照カウンタを-1減算(デクリメント)する(ステップS401)。 FIG. 5 is a flowchart showing an operation in which the fixed-length block management unit 12 and the data storage area management unit 13 shown in FIG. 2 release an unnecessary data storage area. At the same time as the data storage area setting module 13c releases the data storage area, the reference counter holding module 13a decrements (decrements) the reference counter corresponding to the corresponding fixed-length block (step S401).
 参照カウンタの値が0になっていれば(ステップS402)、さらに空き領域ポインタ保持モジュール13bによる空き領域ポインタ42が指し示す当該固定長ブロック内の領域を指し示しているか否かを判断する(ステップS403)。参照カウンタの値が0で、かつ空き領域ポインタ42が当該固定長ブロック内にない場合は、当該固定長ブロックは不使用であり、この固定長ブロック内にはデータ格納領域が存在していないことを意味するので、固定長ブロック管理ユニット12が当該固定長ブロックを未使用ヒープ領域41に戻し、当該固定長ブロックを解放する(ステップS404)。 If the value of the reference counter is 0 (step S402), it is further determined whether or not the area in the fixed-length block indicated by the empty area pointer 42 by the empty area pointer holding module 13b is indicated (step S403). . When the value of the reference counter is 0 and the free area pointer 42 is not in the fixed-length block, the fixed-length block is not used, and there is no data storage area in the fixed-length block. Therefore, the fixed-length block management unit 12 returns the fixed-length block to the unused heap area 41 and releases the fixed-length block (step S404).
(データ格納領域の確保と解放)
 図6は、図1~2で示したRAM11上での、データ格納領域の確保と解放の時間遷移を示した説明図である。初期状態ではRAM11上にデータ格納領域が確保されていない。この状態からプロセッサ10が先頭通信フレームpkt#1を受信すると、まず固定長ブロック管理ユニット12がRAM11上の未使用ヒープ領域41上に固定長ブロック31を確保する(図3:ステップS201~202)。これと同時に、固定長ブロック31に対応する参照カウンタ51も確保され、初期値0とされる(図4:ステップS301~302)。
(Securing and releasing the data storage area)
FIG. 6 is an explanatory diagram showing the time transition of securing and releasing the data storage area on the RAM 11 shown in FIGS. In the initial state, no data storage area is secured on the RAM 11. When the processor 10 receives the leading communication frame pkt # 1 from this state, the fixed-length block management unit 12 first secures the fixed-length block 31 on the unused heap area 41 on the RAM 11 (FIG. 3: steps S201 to 202). . At the same time, the reference counter 51 corresponding to the fixed-length block 31 is also secured and set to the initial value 0 (FIG. 4: steps S301 to 302).
 これに続いて、データ格納領域管理ユニット13のデータ格納領域設定モジュール13cが固定長ブロック31上に通信フレームpkt#1のデータ格納領域61を確保し、そこにpkt#1のデータを格納すると同時に、その容量だけ空き領域ポインタ42が移動する(図3:ステップS203)。これに合わせて、参照カウンタ保持モジュール13aが固定長ブロック31に対応する参照カウンタ51の値も1加算される(図3:ステップS204)。以上で、図6のステップS501に示した状態となる。 Following this, the data storage area setting module 13c of the data storage area management unit 13 secures the data storage area 61 of the communication frame pkt # 1 on the fixed-length block 31, and simultaneously stores the data of pkt # 1 therein. Then, the free area pointer 42 moves by that capacity (FIG. 3: step S203). In accordance with this, the value of the reference counter 51 corresponding to the fixed length block 31 is also incremented by 1 in the reference counter holding module 13a (FIG. 3: step S204). Thus, the state shown in step S501 of FIG. 6 is obtained.
 これに続いてプロセッサ10が通信フレームpkt#2~3を受信すると、同様にデータ格納領域設定モジュール13cがこれらに対応するデータ格納領域62~63が確保されてこれらのデータが格納され、空き領域ポインタ保持モジュール13bが空き領域ポインタ42を移動し(図3:ステップS203)、そのたびに参照カウンタ保持モジュール13aが参照カウンタ51の値を1ずつ加算される(図3:ステップS204)。以上で、図6のステップS502~3に示した状態となる。 Subsequently, when the processor 10 receives the communication frames pkt # 2 to pkt # 2 to 3, the data storage area setting module 13c similarly secures the data storage areas 62 to 63 corresponding to these and stores these data, and the free area The pointer holding module 13b moves the empty area pointer 42 (FIG. 3: step S203), and each time the reference counter holding module 13a increments the value of the reference counter 51 by 1 (FIG. 3: step S204). Thus, the state shown in steps S502 to S3 of FIG. 6 is obtained.
 これに続いて、プロセッサ10が通信フレームpkt#1~2の送出を完了して処理が終了したので、データ格納領域設定モジュール13cがこれらのデータ格納領域を解放し、参照カウンタ保持モジュール13aが参照カウンタ51の値を1ずつ減算する(図5:ステップS401)。以上で、図6のステップS504に示した状態となる。 Subsequently, since the processor 10 completes the transmission of the communication frames pkt # 1 and pkt # 2 and the processing is completed, the data storage area setting module 13c releases these data storage areas, and the reference counter holding module 13a refers to them. The value of the counter 51 is subtracted by 1 (FIG. 5: step S401). Thus, the state shown in step S504 of FIG. 6 is obtained.
 これに続いてプロセッサ10が通信フレームpkt#4を受信すると、空き領域ポインタ保持モジュール13bが空き領域ポインタ42をpkt#3の後に続く空き領域に移動し、データ格納領域設定モジュール13cがこの領域にデータ格納領域64が確保されてこれらのデータを格納し(図3:ステップS203)、これに対応して参照カウンタ保持モジュール13aが参照カウンタ51の値を加算する(図3:ステップS204)。以上で、図6のステップS505に示した状態となる。 Subsequently, when the processor 10 receives the communication frame pkt # 4, the free area pointer holding module 13b moves the free area pointer 42 to the free area that follows pkt # 3, and the data storage area setting module 13c enters this area. A data storage area 64 is secured to store these data (FIG. 3: step S203), and the reference counter holding module 13a adds the value of the reference counter 51 correspondingly (FIG. 3: step S204). Thus, the state shown in step S505 in FIG. 6 is obtained.
 この時点ではpkt#1~2の領域が開放されているので、この領域のあった部分にpkt#4のデータ格納領域を確保することも考えられるが、本実施形態ではこの部分を使用しない。これにより、それぞれの固定長ブロック内ではデータ格納領域が確保された時刻順に一方向に近接して配置されることになり、データ生存期間の異なるもの同士が同じ固定長ブロック内に配置されるのを回避してフラグメントの原因の発生を防ぐことになる。 At this point, since the areas of pkt # 1 and pkt # 2 are open, it is conceivable to secure the data storage area of pkt # 4 in this area, but this part is not used in this embodiment. As a result, in each fixed-length block, the data storage areas are arranged in one direction close to each other in the order in which the data storage areas are secured, and those having different data lifetimes are arranged in the same fixed-length block. This will prevent the occurrence of fragment causes.
 これに続いてプロセッサ10が通信フレームpkt#5を受信すると、固定長ブロック31のpkt#4の後に続く空き領域にはpkt#5を格納できる容量が残っていない(前述のpkt#1~2の領域に十分な空きがあっても)ので、固定長ブロック管理ユニット12がRAM11上に新たな固定長ブロック32を確保し(図3:ステップS201~202)、固定長ブロック32に対応する参照カウンタ52を確保して初期値0とする(図4:ステップS301~302)。 Subsequently, when the processor 10 receives the communication frame pkt # 5, there is no remaining space for storing the pkt # 5 in the free area following the pkt # 4 of the fixed-length block 31 (the above-mentioned pkt # 1-2). Therefore, the fixed-length block management unit 12 secures a new fixed-length block 32 on the RAM 11 (FIG. 3: steps S201 to 202), and the reference corresponding to the fixed-length block 32 is stored. The counter 52 is secured and set to an initial value 0 (FIG. 4: steps S301 to S302).
 データ格納領域設定モジュール13cは、固定長ブロック32上に通信フレームpkt#5のデータ格納領域65を確保してこれらのデータを格納し、さらに空き領域ポインタ保持モジュール13bが空き領域ポインタ42を移動し(図3:ステップS203)、参照カウンタ保持モジュール13aが固定長ブロック32に対応する参照カウンタ52の値を1だけ加算する(図3:ステップS204)。以上で、図6のステップS506に示した状態となる。 The data storage area setting module 13c secures the data storage area 65 of the communication frame pkt # 5 on the fixed-length block 32 and stores these data, and the free area pointer holding module 13b moves the free area pointer 42. (FIG. 3: step S203), the reference counter holding module 13a adds 1 to the value of the reference counter 52 corresponding to the fixed length block 32 (FIG. 3: step S204). Thus, the state shown in step S506 of FIG. 6 is obtained.
 これに続いて、プロセッサ10が通信フレームpkt#3~4の送出を完了して処理が終了したので、データ格納領域設定モジュール13cがこれらのデータ格納領域を解放し、参照カウンタ保持モジュール13aが参照カウンタ51の値を減算する(図5:ステップS401)とその値が0になり(図5:ステップS402)、しかも空き領域ポインタ42は固定長ブロック32を指しているので(図5:ステップS403)、固定長ブロック31には既にデータが存在していないことになる。従って、固定長ブロック管理ユニット12はこの固定長ブロック31を解放して未使用ヒープ領域41に戻す(図5:ステップS404)。以上で、図6のステップS507に示した状態となる。 Subsequently, since the processor 10 completes the transmission of the communication frames pkt # 3 to 4 and the processing is completed, the data storage area setting module 13c releases these data storage areas, and the reference counter holding module 13a refers to them. When the value of the counter 51 is subtracted (FIG. 5: Step S401), the value becomes 0 (FIG. 5: Step S402), and the empty area pointer 42 points to the fixed length block 32 (FIG. 5: Step S403). ), No data already exists in the fixed-length block 31. Therefore, the fixed-length block management unit 12 releases the fixed-length block 31 and returns it to the unused heap area 41 (FIG. 5: Step S404). Thus, the state shown in step S507 of FIG. 6 is obtained.
 この後にプロセッサ10が通信フレームpkt#6を受信すると、データ格納領域設定モジュール13cはこのpkt#6を固定長ブロック32上のpkt#5に続くデータ格納領域66に格納し、これに伴って参照カウンタ保持モジュール13aが参照カウンタ52の値を加算する(図3:ステップS203~204)。以上で、図6のステップS508に示した状態となる。以後、これと同様の処理を繰り返す。 Thereafter, when the processor 10 receives the communication frame pkt # 6, the data storage area setting module 13c stores this pkt # 6 in the data storage area 66 subsequent to pkt # 5 on the fixed length block 32, and is referred to accordingly. The counter holding module 13a adds the value of the reference counter 52 (FIG. 3: steps S203 to 204). Thus, the state shown in step S508 of FIG. 6 is obtained. Thereafter, the same processing is repeated.
(第1の実施形態の全体的な動作)
 次に、上記の実施形態の全体的な動作について説明する。本実施形態に係る動作は、メモリ11上のヒープ領域21中に可変長データを一時的に格納して処理するユニットを備えたデータ処理装置にあって、メモリ11上に可変長データを格納する格納領域61~6M(Mは自然数)を確保するメモリ管理方法であって、空き領域ポインタ保持モジュールからデータ格納領域設定モジュールが格納領域61~6Mの末尾を示すアドレス情報を読み込み、空き領域ポインタ42の示すアドレス情報の順にデータ格納領域設定モジュール13cが可変長データの格納領域61~6Mを順次確保し、確保された格納領域61~6Mにデータ格納領域設定モジュール13cが可変長データを格納する。
(Overall operation of the first embodiment)
Next, the overall operation of the above embodiment will be described. The operation according to this embodiment is a data processing apparatus including a unit that temporarily stores and processes variable length data in the heap area 21 on the memory 11, and stores the variable length data on the memory 11. A memory management method for securing storage areas 61 to 6M (M is a natural number), in which the data storage area setting module reads address information indicating the end of the storage areas 61 to 6M from the free area pointer holding module, and free area pointer 42 The data storage area setting module 13c sequentially secures the variable length data storage areas 61 to 6M in the order of the address information indicated by the data storage area 61 to 6M, and the data storage area setting module 13c stores the variable length data in the reserved storage areas 61 to 6M.
 ここで、データ格納領域設定モジュール13cが可変長データの格納領域61~6Mを確保する際、空き領域ポインタ保持モジュール13bが保持する空き領域ポインタ42が指し示す値を先頭として当該アドレスが属する固定長ブロック31~3Nの末尾との間の空き領域を格納領域61~6Mとすると共に(図3:ステップS203)、空き領域の容量が格納領域61~6Mとして確保しようとしている容量に対して不足していれば固定長ブロック管理ユニット12が新たに割り当てた固定長ブロック上に格納領域を確保する(図3:ステップS202~203)。 Here, when the data storage area setting module 13c secures the variable length data storage areas 61 to 6M, the fixed length block to which the address belongs, starting from the value indicated by the empty area pointer 42 held by the empty area pointer holding module 13b. The free area between 31 and 3N is defined as storage areas 61 to 6M (FIG. 3: step S203), and the capacity of the free area is insufficient for the capacity to be secured as the storage areas 61 to 6M. Then, a storage area is secured on the fixed-length block newly allocated by the fixed-length block management unit 12 (FIG. 3: steps S202 to 203).
 そして、データ格納領域設定モジュール13cが格納領域を解放する際、解放された格納領域61~6Mが属する固定長ブロック31~3N上の格納領域の個数をデータ格納領域設定モジュール13cがチェックし(図4:ステップS401~2)、該格納領域の参照カウンタ51~5Nの値が0でかつ空き領域ポインタ42が保持するアドレスが該固定長ブロックを示していなければ、固定長ブロック管理ユニット12が該固定長ブロックを解放する(図4:ステップS402~4)。 When the data storage area setting module 13c releases the storage area, the data storage area setting module 13c checks the number of storage areas on the fixed-length blocks 31 to 3N to which the released storage areas 61 to 6M belong (see FIG. 4: Step S401-2), if the value of the reference counters 51-5N of the storage area is 0 and the address held by the free area pointer 42 does not indicate the fixed-length block, the fixed-length block management unit 12 The fixed-length block is released (FIG. 4: steps S402 to S4).
 ここで、上記各動作ステップについては、これをコンピュータで実行可能にプログラム化し、これらを前記各ステップを直接実行する主体であるCPU10に実行させるようにしてもよい。
 この動作により、本実施形態は以下のような効果を奏する。
Here, each of the above-described operation steps may be programmed to be executable by a computer, and these may be executed by the CPU 10 which is a main body that directly executes each of the steps.
By this operation, this embodiment has the following effects.
 本実施形態は、通信データが持つ「ほぼ到着順に処理される」という特性、および「データの生存期間がほぼ等しい」という特性を前提としている。本実施形態は、この前提を利用して、通信フレームを格納するデータ領域を確保するにあたって、直前に確保したデータ領域の直後に次のデータ格納領域を連続して確保するように構成したので、固定長ブロック内のデータ格納領域に格納されたデータが、到着の古い順に並ぶようになる。 This embodiment is premised on the characteristics of communication data that are “processed almost in the order of arrival” and the characteristics that “the lifetime of data is almost equal”. In this embodiment, using this premise, when securing a data area for storing a communication frame, the next data storage area is continuously secured immediately after the data area secured immediately before. Data stored in the data storage area in the fixed-length block is arranged in the order of arrival.
 これらのデータ格納領域は、ほとんどの場合、データの生存期間がお互いに近いもの同士を連続して保持している。そして通信処理が進むに従って、ほとんどの場合は古い順に解放されていくので、データ格納領域の連続性が維持され、空き領域の断片が散在するフラグメンテーション状態にはなりにくい。従って、メモリの使用効率を高くすることができる。 In most cases, these data storage areas continuously hold data whose lifetimes are close to each other. As communication processing progresses, in most cases, the data storage areas are released in the oldest order, so that the continuity of the data storage area is maintained, and it is difficult for a fragmentation state in which fragments of free areas are scattered. Therefore, the memory usage efficiency can be increased.
 また、固定長ブロックの中には連続的にデータ格納領域が確保されるので、固定長ブロックの使用効率が高い状態か、もしくは未使用状態のいずれかの状態を取りうる時間が長くなり、その間の状態が存在したとしても短時間のうちに連続してデータ領域の解放が行われるので、未使用状態に遷移することになる。 In addition, since the data storage area is continuously secured in the fixed-length block, the time during which either the fixed-length block can be used efficiently or unused can be increased. Even if this state exists, the data area is continuously released within a short time, so that the state changes to an unused state.
 通信処理の仕様として最大帯域と最大滞留時間の積が定められているので、そこからある時刻に保持しなければいけない最大通信フレーム総量が求められる。本実施形態では、ヒープ領域21の空き領域断片総量を小さくすることができるので、物理的に用意しなければならないRAM11のリソース量はこの最大通信フレーム総量に合わせて確保すれば良いことになる。即ち、本実施形態によれば、必要なメモリデバイスのリソース量を精度高く見積もることができるようになる。 Since the product of the maximum bandwidth and the maximum dwell time is defined as the specification of communication processing, the maximum total amount of communication frames that must be held at a certain time is determined. In this embodiment, since the total amount of free area fragments in the heap area 21 can be reduced, the resource amount of the RAM 11 that must be physically prepared may be ensured in accordance with the maximum total communication frame amount. That is, according to the present embodiment, it is possible to accurately estimate the required amount of memory device resources.
 また、本実施形態では、図3~5のフローチャートに示した領域の確保および解放に係るいずれの処理においても、フラグメンテーションによる発生した散在した空き領域ごとに次データが格納可能かどうかを判断しながらヒープ領域を探索するなどのような、領域の使用状況に依存して時間が変わる処理を必要としない。従って、使用しているデータの個数や分量に依存せず、ほぼ固定時間での処理が可能である。このため、メモリ管理領域が増大しても常に同じ処理時間でメモリ管理を行うことができ、メモリ管理にかかるプロセッサの処理負荷を低減することができる。 In this embodiment, in any of the processes related to securing and releasing the areas shown in the flowcharts of FIGS. 3 to 5, it is determined whether the next data can be stored for each scattered free area generated by fragmentation. It does not require processing that changes the time depending on the usage status of the area, such as searching the heap area. Therefore, it is possible to perform processing in a substantially fixed time without depending on the number or amount of data being used. For this reason, even if the memory management area increases, memory management can always be performed in the same processing time, and the processing load on the processor related to memory management can be reduced.
(第2の実施形態)
 本発明の第2の実施形態は、ネットワークおよびハードウェアの構成、さらにソフトウェアの大まかな構成は、図1~6で述べた第1の実施形態と同一である。第2の実施形態が前述の第1の実施形態と異なる点は、固定長ブロック管理ユニット12が可変長データの生存期間に応じて設定される複数の論理チャネルごとに固定長ブロックの割り当ておよび解放を実行する構成とし、空き領域ポインタ保持モジュール13bが空き領域ポインタ71~7Kを論理チャネルごとに一つずつ保持する構成としたという点にある。これによって、生存期間の異なるデータが共存する場合にも、第1の実施形態と同一の効果を得ることができる。
 以下、これをより詳細に説明する。
(Second Embodiment)
The second embodiment of the present invention is the same as the first embodiment described with reference to FIGS. 1 to 6 in terms of the network and hardware configurations, and the general software configuration. The second embodiment differs from the first embodiment described above in that the fixed-length block management unit 12 allocates and releases fixed-length blocks for each of a plurality of logical channels set according to the lifetime of variable-length data. The free area pointer holding module 13b holds the free area pointers 71 to 7K one by one for each logical channel. As a result, even when data with different lifetimes coexist, the same effect as in the first embodiment can be obtained.
Hereinafter, this will be described in more detail.
 本発明の第2の実施形態では、通信機器のハードウェアおよびソフトウェアの構成は、前述の第1の実施形態と同一である。図7は、本発明の第2の実施形態におけるRAM11上の記憶領域の構成を示す説明図である。図7(a)は、RAM11上にヒープ領域21を確保した状態を示す。図7(b)は、固定長ブロック管理ユニット12がヒープ領域21上にN個の固定長ブロック31~3N(Nは整数)を確保した状態を示す。固定長ブロック31~3N以外の領域は未使用ヒープ領域41となる。そして図7(c)は、固定長ブロック31~3N上に、データ格納領域設定モジュール13cがデータ格納領域61~6M(Mは整数)を確保した状態を示す。図7(c)で「K1」および「K2」として表記してある斜線でハッチングされている領域が、確保されているデータ格納領域61~6Mを表す。「K1」が論理チャネル#1を表し、「K2」が論理チャネル#2を表す。 In the second embodiment of the present invention, the hardware and software configurations of the communication device are the same as those in the first embodiment. FIG. 7 is an explanatory diagram showing the configuration of the storage area on the RAM 11 in the second embodiment of the present invention. FIG. 7A shows a state where the heap area 21 is secured on the RAM 11. FIG. 7B shows a state in which the fixed-length block management unit 12 has secured N fixed-length blocks 31 to 3N (N is an integer) on the heap area 21. An area other than the fixed-length blocks 31 to 3N becomes an unused heap area 41. FIG. 7C shows a state in which the data storage area setting module 13c has secured the data storage areas 61 to 6M (M is an integer) on the fixed-length blocks 31 to 3N. Areas hatched with diagonal lines denoted as “K1” and “K2” in FIG. 7C represent reserved data storage areas 61 to 6M. “K1” represents logical channel # 1, and “K2” represents logical channel # 2.
 本実施形態では、ヒープ領域21上のN個の固定長ブロック31~3N(Nは整数)内にK個の論理チャネル(Kは整数)が用意され、これらの論理チャネルの各々に対して空き領域ポインタ71~7Kが用意される。この点以外は、図1で示した第1の実施形態と同一の構成である。 In the present embodiment, K logical channels (K is an integer) are prepared in N fixed-length blocks 31 to 3N (N is an integer) on the heap area 21, and each of these logical channels is free. Area pointers 71 to 7K are prepared. Except for this point, the configuration is the same as that of the first embodiment shown in FIG.
 ここでいう論理チャネルとは、上位装置で異なる通信を行う際にアプリケーション毎に割り当てられる仮想的なチャネルであり、通信フレームの特徴としてサイズや時間あたりの個数を決める要素となるものである。空き領域ポインタ71~7Kは、新たな領域の確保を行う候補アドレスを、論理チャネル毎に保持している。これにより、論理チャネル毎に異なる固定長ブロックを使用することになる。 Here, the logical channel is a virtual channel assigned for each application when different communication is performed in the host device, and is a factor that determines the size and the number per time as a feature of the communication frame. The free area pointers 71 to 7K hold candidate addresses for securing new areas for each logical channel. As a result, different fixed-length blocks are used for each logical channel.
 そして、各々の空き領域ポインタ71~7Kは、各々の論理チャネルごとに、第1の実施形態における空き領域ポインタ42と同一の動作を行う。そして各々の論理チャネルごとに、第1の実施形態と同一の動作でデータ格納領域を確保および解放することが可能である。 The free area pointers 71 to 7K perform the same operation as the free area pointer 42 in the first embodiment for each logical channel. For each logical channel, the data storage area can be secured and released by the same operation as in the first embodiment.
 第1の実施形態では、どのデータも生存期間がほぼ同一であることが、前述のような効果を得られる前提となっている。しかしながら、複数のアプリケーションが同時に動作する環境などでは、この複数のアプリケーションごとに優先度やQoSパラメータの異なる複数のデータ種類が設定され、そのためデータ種類ごとに異なる生存期間が必要となる場合がある。このような場合に、生存期間の異なるデータが互いに接近したデータ格納領域で連続していると、第1の実施形態と同一の効果を得ることができない。 In the first embodiment, it is a premise that the above-described effects can be obtained that all data have substantially the same lifetime. However, in an environment where a plurality of applications operate simultaneously, a plurality of data types having different priorities and QoS parameters are set for each of the plurality of applications, and thus different lifetimes may be required for each data type. In such a case, the same effect as in the first embodiment cannot be obtained if data having different lifetimes are continuous in the data storage areas close to each other.
 このように生存期間の異なるデータがRAM11内に共存した場合にも、その生存期間ごとに異なる論理チャネルを使用し、論理チャネル毎に異なる固定長ブロックを使用するようにすれば、この第2の実施形態によって第1の実施形態と同一の効果を得ることができる。 Thus, even when data having different lifetimes coexist in the RAM 11, if different logical channels are used for different lifetimes and different fixed-length blocks are used for different logical channels, this second According to the embodiment, the same effect as that of the first embodiment can be obtained.
 これまで本発明について図面に示した特定の実施形態をもって説明してきたが、本発明は図面に示した実施形態に限定されるものではなく、本発明の効果を奏する限り、これまで知られたいかなる構成であっても採用することができる。 The present invention has been described with reference to the specific embodiments shown in the drawings. However, the present invention is not limited to the embodiments shown in the drawings, and any known hitherto provided that the effects of the present invention are achieved. Even if it is a structure, it is employable.
 この出願は2009年1月14日に出願された日本出願特願2009-005942を基礎とする優先権を主張し、その開示の全てをここに取り込む。 This application claims priority based on Japanese Patent Application No. 2009-005942 filed on Jan. 14, 2009, the entire disclosure of which is incorporated herein.
 本発明は、プロセッサと、プロセッサによって制御されるRAMとを備える機器に対して適用可能であるが、特に前述のように通信フレームもしくは通信パケットというデータ種類を扱う機器において、顕著な効果を発揮する。従って、様々な通信レイヤにおいてフレームやパケットを処理する通信処理装置に好適である。また、ストリーミング処理を行う装置や、動画や音声などのコーデック処理を行うマルチメディア処理装置にも好適である。 The present invention can be applied to a device including a processor and a RAM controlled by the processor, but exhibits a remarkable effect particularly in a device that handles data types such as communication frames or communication packets as described above. . Therefore, it is suitable for a communication processing apparatus that processes frames and packets in various communication layers. Further, the present invention is also suitable for a device that performs streaming processing and a multimedia processing device that performs codec processing such as video and audio.
  1 通信機器
  10 プロセッサ
  11 RAM
  12 固定長ブロック管理ユニット
  13 データ格納領域管理ユニット
  21 ヒープ領域
  31~3N 固定長ブロック
  41 未使用ヒープ領域
  42、71~7K 空き領域ポインタ
  51~5N 参照カウンタ
  61~6M データ格納領域
1 Communication equipment 10 Processor 11 RAM
12 Fixed-length block management unit 13 Data storage area management unit 21 Heap area 31-3N Fixed-length block 41 Unused heap area 42, 71-7K Free area pointer 51-5N Reference counter 61-6M Data storage area

Claims (11)

  1.  メモリ領域に可変長データを一時的に格納して処理する手段を備えたデータ処理装置であって、
     前記メモリ領域中に固定長ブロックを割り当ておよび解放する固定長ブロック管理手段と、前記固定長ブロック中に前記可変長データを格納する格納領域を確保および解放するデータ格納領域管理手段とを備え、
     前記データ格納領域管理手段が、前記固定長ブロックごとに前記格納領域の個数を保持する参照カウンタ保持部と、前記格納領域の末尾を示すアドレス情報を保持する空き領域ポインタ保持部と、このアドレス情報順に前記可変長データの格納領域を順次確保および解放するデータ格納領域設定部とを備えることを特徴とするデータ処理装置。
    A data processing apparatus comprising means for temporarily storing and processing variable length data in a memory area,
    Fixed length block management means for allocating and releasing fixed length blocks in the memory area, and data storage area management means for securing and releasing storage areas for storing the variable length data in the fixed length blocks,
    The data storage area management means includes a reference counter holding section that holds the number of storage areas for each fixed-length block, a free area pointer holding section that holds address information indicating the end of the storage area, and the address information A data processing apparatus comprising: a data storage area setting unit for sequentially securing and releasing the storage area for the variable length data in order.
  2.  前記データ格納領域設定部が、前記可変長データの格納領域を確保するに際して前記空き領域ポインタ保持部が保持する値を先頭アドレスとして当該アドレスが属する固定長ブロックの末尾との間の空き領域を前記格納領域とする格納領域設定機能を有すると共に、前記空き領域の容量が前記格納領域として確保しようとしている容量に対して不足しているか否かを判断する容量判断機能を有し、
     前記固定長ブロック管理手段が、前記データ格納領域設定部によって前記空き領域の容量が不足していると判断された場合に、新たに固定長ブロックを割り当てる新規割り当て機能を有することを特徴とする、請求項1に記載のデータ処理装置。
    When the data storage area setting unit secures the storage area for the variable length data, the empty area between the end of the fixed-length block to which the address belongs with the value held by the empty area pointer holding part as the start address Having a storage area setting function as a storage area, and having a capacity determination function for determining whether the capacity of the free area is insufficient with respect to the capacity to be secured as the storage area,
    The fixed-length block management means has a new allocation function for newly allocating a fixed-length block when the data storage area setting unit determines that the capacity of the free area is insufficient. The data processing apparatus according to claim 1.
  3.  前記データ格納領域設定部が、前記格納領域を解放するに際して前記解放された格納領域が属する固定長ブロックに対応する参照カウンタの数値をチェックする参照カウンタチェック機能を有すると共に、該格納領域の前記参照カウンタの値が0でありかつ前記空き領域ポインタが保持するアドレスが該固定長ブロックを示していない場合に該固定長ブロックが不使用であると判断する不使用ブロック判断機能を有し、
     前記固定長ブロック管理手段が、前記データ格納領域設定部によって該固定長ブロックが不使用であると判断された場合に、該固定長ブロックを解放する不使用ブロック解放機能を有することを特徴とする、請求項2に記載のデータ処理装置。
    The data storage area setting unit has a reference counter check function for checking a numerical value of a reference counter corresponding to a fixed-length block to which the released storage area belongs when releasing the storage area, and the reference of the storage area A non-use block determination function for determining that the fixed-length block is not used when the counter value is 0 and the address held by the free area pointer does not indicate the fixed-length block;
    The fixed-length block management means has an unused block release function for releasing the fixed-length block when the data storage area setting unit determines that the fixed-length block is not used. The data processing apparatus according to claim 2.
  4.  前記メモリ領域中で前記固定長ブロックとして割り当てられていない未使用領域を管理する管理キューを有することを特徴とする、請求項1に記載のデータ処理装置。 The data processing apparatus according to claim 1, further comprising a management queue for managing an unused area that is not allocated as the fixed-length block in the memory area.
  5.  前記固定長ブロック管理手段は、前記可変長データの生存期間に応じて設定される複数の論理チャネルごとに前記固定長ブロックの割り当ておよび解放を実行する構成とし、
     前記空き領域ポインタ保持部は、前記空き領域ポインタを前記論理チャネルごとに一つずつ保持する構成としたことを特徴とする、請求項1に記載のデータ処理装置。
    The fixed-length block management means is configured to execute allocation and release of the fixed-length block for each of a plurality of logical channels set according to the lifetime of the variable-length data,
    2. The data processing apparatus according to claim 1, wherein the free area pointer holding unit is configured to hold the free area pointer one by one for each logical channel.
  6.  メモリ領域に可変長データを一時的に格納して処理する手段を備えたデータ処理装置にあって、前記メモリ領域に前記可変長データを格納する格納領域を確保するメモリ管理方法であって、
     空き領域ポインタ保持部からデータ格納領域設定部が前記格納領域の末尾を示すアドレス情報を読み込み、
     前記アドレス情報の順に前記データ格納領域設定部が前記可変長データの格納領域を順次確保し、
     前記確保された格納領域に前記データ格納領域設定部が前記可変長データを格納することを特徴とするメモリ管理方法。
    In a data processing apparatus comprising means for temporarily storing and processing variable length data in a memory area, a memory management method for securing a storage area for storing the variable length data in the memory area,
    The data storage area setting unit reads address information indicating the end of the storage area from the free area pointer holding unit,
    The data storage area setting unit sequentially secures a storage area for the variable length data in the order of the address information,
    A memory management method, wherein the data storage area setting unit stores the variable length data in the reserved storage area.
  7.  前記データ格納領域設定部が前記可変長データの格納領域を確保する際、前記アドレスを先頭として当該アドレスが属する固定長ブロックの末尾との間の空き領域を前記格納領域とすると共に、前記空き領域の容量が前記格納領域として確保しようとしている容量に対して不足していれば固定長ブロック管理手段が新たに割り当てた固定長ブロック上に前記格納領域を確保することを特徴とする、請求項6に記載のメモリ管理方法。 When the data storage area setting unit reserves a storage area for the variable length data, an empty area between the address and the end of the fixed length block to which the address belongs is used as the storage area, and the empty area 7. The storage area is secured on a fixed-length block newly allocated by fixed-length block management means if the capacity of the storage area is insufficient with respect to the capacity to be secured as the storage area. Memory management method described in 1.
  8.  前記データ格納領域設定部が前記格納領域を解放する際、前記解放された格納領域が属する固定長ブロック上の前記格納領域の個数を前記データ格納領域設定部がチェックし、該格納領域の個数が0でかつ前記アドレスが該固定長ブロックを示していなければ前記固定長ブロック管理手段が該固定長ブロックを解放することを特徴とする、請求項7に記載のメモリ管理方法。 When the data storage area setting unit releases the storage area, the data storage area setting unit checks the number of storage areas on the fixed-length block to which the released storage area belongs, and the number of storage areas is 8. The memory management method according to claim 7, wherein if the address is 0 and the address does not indicate the fixed length block, the fixed length block managing means releases the fixed length block.
  9.  メモリ領域に可変長データを一時的に格納して処理する手段を備えたデータ処理装置にあって、
     空き領域ポインタ保持部からデータ格納領域設定部が前記格納領域の末尾を示すアドレス情報を読み込む機能と、
     前記アドレス情報の順に前記データ格納領域設定部が前記可変長データの格納領域を順次確保する機能と、
     前記確保された格納領域に前記データ格納領域設定部が前記可変長データを格納する機能と
    をコンピュータに実行させることを特徴とするメモリ管理プログラム。
    A data processing apparatus having means for temporarily storing and processing variable length data in a memory area,
    A function in which the data storage area setting unit reads address information indicating the end of the storage area from the free area pointer holding unit;
    A function for the data storage area setting unit to sequentially secure storage areas for the variable-length data in the order of the address information;
    A memory management program for causing a computer to execute a function of the data storage area setting unit storing the variable length data in the reserved storage area.
  10.  前記データ格納領域設定部が前記可変長データの格納領域を確保する際、前記アドレスを先頭として当該アドレスが属する固定長ブロックの末尾との間の空き領域を前記格納領域とすると共に、前記空き領域の容量が前記格納領域として確保しようとしている容量に対して不足していれば固定長ブロック管理手段が新たに割り当てた固定長ブロック上に前記格納領域を確保する機能をコンピュータに実行させることを特徴とする、請求項9に記載のメモリ管理プログラム。 When the data storage area setting unit reserves a storage area for the variable length data, an empty area between the address and the end of the fixed length block to which the address belongs is used as the storage area, and the empty area If the capacity of the storage area is insufficient with respect to the capacity to be secured as the storage area, the fixed-length block management means causes the computer to execute a function of securing the storage area on the fixed-length block newly allocated. The memory management program according to claim 9.
  11.  前記データ格納領域設定部が前記格納領域を解放する際、前記解放された格納領域が属する固定長ブロック上の前記格納領域の個数を前記データ格納領域設定部がチェックし、該格納領域の個数が0でかつ前記アドレスが該固定長ブロックを示していなければ前記固定長ブロック管理手段が該固定長ブロックを解放する機能をコンピュータに実行させることを特徴とする、請求項10に記載のメモリ管理プログラム。 When the data storage area setting unit releases the storage area, the data storage area setting unit checks the number of storage areas on the fixed-length block to which the released storage area belongs, and the number of storage areas is 11. The memory management program according to claim 10, wherein if the address is 0 and the address does not indicate the fixed-length block, the fixed-length block management means causes the computer to execute a function of releasing the fixed-length block. .
PCT/JP2010/050349 2009-01-14 2010-01-14 Data processing device, method of memory management, and memory management program WO2010082604A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010546643A JPWO2010082604A1 (en) 2009-01-14 2010-01-14 Data processing apparatus, memory management method, and memory management program

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2009005942 2009-01-14
JP2009-005942 2009-01-14

Publications (1)

Publication Number Publication Date
WO2010082604A1 true WO2010082604A1 (en) 2010-07-22

Family

ID=42339858

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2010/050349 WO2010082604A1 (en) 2009-01-14 2010-01-14 Data processing device, method of memory management, and memory management program

Country Status (2)

Country Link
JP (1) JPWO2010082604A1 (en)
WO (1) WO2010082604A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014142861A1 (en) * 2013-03-14 2014-09-18 Intel Corporation Memory object reference count management with improved scalability
JP2015203990A (en) * 2014-04-14 2015-11-16 京セラドキュメントソリューションズ株式会社 Electronic device and memory management method

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08241186A (en) * 1995-03-07 1996-09-17 Fujitsu Ltd Unit and method for buffer memory management

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08241186A (en) * 1995-03-07 1996-09-17 Fujitsu Ltd Unit and method for buffer memory management

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014142861A1 (en) * 2013-03-14 2014-09-18 Intel Corporation Memory object reference count management with improved scalability
US9384037B2 (en) 2013-03-14 2016-07-05 Intel Corporation Memory object reference count management with improved scalability
JP2015203990A (en) * 2014-04-14 2015-11-16 京セラドキュメントソリューションズ株式会社 Electronic device and memory management method

Also Published As

Publication number Publication date
JPWO2010082604A1 (en) 2012-07-05

Similar Documents

Publication Publication Date Title
US8327047B2 (en) Buffer manager and methods for managing memory
WO2017133623A1 (en) Data stream processing method, apparatus, and system
US20210089343A1 (en) Information processing apparatus and information processing method
US8325603B2 (en) Method and apparatus for dequeuing data
US20070073973A1 (en) Method and apparatus for managing buffers in a data processing system
US8312243B2 (en) Memory management in network processors
US20140359231A1 (en) System and Method for Efficient Buffer Management for Banked Shared Memory Designs
US20050147100A1 (en) Dynamic management of TCP reassembly buffers
US10489204B2 (en) Flexible in-order and out-of-order resource allocation
WO2016127291A1 (en) Memory management device and method
US6697923B2 (en) Buffer management method and a controller thereof
TWI730481B (en) Network packets receiving apparatus and method
US7865632B2 (en) Memory allocation and access method and device using the same
US7694041B2 (en) Method for managing buffers pool and a system using the method
WO2010082604A1 (en) Data processing device, method of memory management, and memory management program
US20200371708A1 (en) Queueing Systems
CN114401072B (en) Dynamic buffer control method and system for frame disassembly reordering queue based on HINOC protocol
US20060153185A1 (en) Method and apparatus for dynamically changing ring size in network processing
CN114186163A (en) Application layer network data caching method
KR20040101386A (en) Morphing memory pools
KR100898345B1 (en) Packet receiver hardware apparatus for tcp offload engine and system and method based on ??? packet receive hardware
WO2016006228A1 (en) Virtualization system and virtualization method
US9965211B2 (en) Dynamic packet buffers with consolidation of low utilized memory banks
US10747672B2 (en) Managing a datalog space of a data cache
JP2005235046A (en) Data transfer device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 10731273

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2010546643

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10731273

Country of ref document: EP

Kind code of ref document: A1