Browse Prior Art Database

Efficiently copying and restoring a large number of complex objects for sophisticated object manipulation Disclosure Number: IPCOM000016589D
Original Publication Date: 2003-Jul-01
Included in the Prior Art Database: 2003-Jul-01
Document File: 4 page(s) / 48K

Publishing Venue


This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 55% of the total text.

Page 1 of 4

  Efficiently copying and restoring a large number of complex objects for sophisticated object manipulation

         In many programming scenarios using objects, it is commonly required to try different approaches, combinations, or alterantives using certain data structures containing a large number of complex objects, and then choose the best solution. In the process, the objects may be changed and there is a need to save them and then restore them for later use. When the objects are referenced each other in a complex structure (such as a graph or a parse tree), object-by-object copying is time-consuming and error-prone. Not only is its coding time-consuming, but its execution is also less efficient.

      The copy logic becomes much more complex if the objects reference other objects or reference each other. In that case, the copy sequence has to be arranged, and correspondence between original objects and their new copies has to be maintained, so that the references in the resultant copy are consistent.

      We devised an efficient memory image copy technique to quickly save and restore a large number of complex objects. The objects are allocated in memory blocks, which can be traced, either by linked list or array. To save a copy of objects, we save an image copy of the memory blocks, instead of copies of individual objects. To restore the objects, we copy the image copy of the memory blocks to their original locations. This technique can be used for in-memory copying or on-disk copying. The technique has the advantages of simple logic and execution efficiency. It also avoids object-by-object copy logic and potential reference inconsistency problems.

The technique includes the following aspects:

Two levels of memory allocation: objects to be saved and restored are allocated in memory blocks.

The related memory blocks are remembered using a linked list or an array. To save objects: All the related memory blocks are copied instead of individual objects. The copies

can be anchored from the original memory blocks, or on their own linked lists. To restore objects: All the saved memory blocks are copied to their original locations. The original

memory blocks should not be deallocated before all the alternatives are tried and copying is no longer needed.

The following figure shows the memory blocks before copying, any arbitrarily complex objects can be in these memory blocks:





The next figure shows one copy of the memory blocks is made, which means a copy of all the objects is made. The copied memory blocks are anchored from...