Fact-checked by Grok 2 weeks ago

Object copying

Object copying is a fundamental concept in (OOP) that involves creating a duplicate of an existing object, producing a new instance with the same and values while allowing independent modification without affecting the original. This process is essential for tasks such as , where copies prevent unintended side effects from mutable objects, and for maintaining snapshots of object states during execution. In OOP languages, object copying typically distinguishes between shallow copying, which duplicates the top-level object but shares references to nested objects, and deep copying, which recursively duplicates all nested structures to ensure complete independence. Shallow copying is the default behavior in many languages, such as 's Object.clone() method, which copies field values including references to mutable sub-objects, potentially leading to shared state issues if those sub-objects are modified. For example, in , the copy.copy() function from the copy module performs a shallow copy by creating a new compound object while inserting references into the original nested objects, making it efficient but risky for complex data structures. In contrast, deep copying addresses these limitations by fully replicating the object's hierarchy; 's copy.deepcopy() recursively copies all elements, using a dictionary to handle cycles and avoid infinite . Similarly, in , deep copies require manual implementation, often by overriding clone() to invoke cloning on mutable fields or using to produce independent instances. The choice between shallow and deep copying impacts performance, memory usage, and program correctness, with shallow copies being faster and less resource-intensive for simple objects, while deep copies are necessary for ensuring in scenarios involving mutable nested . Languages provide built-in or require custom methods like copy constructors in C++ to facilitate these operations, emphasizing the need for developers to understand reference semantics to avoid bugs from .

Fundamentals

Definition and Motivation

Object copying in programming refers to the creation of a new, independent instance of an object that duplicates the original's structure and data, distinct from simple reference assignment which merely points multiple variables to the same memory location. This process ensures that the copy operates autonomously, preserving the integrity of both the original and the duplicate without implicit dependencies. The primary motivation for object copying stems from the challenges posed by shared mutable state in programming languages, where aliasing—multiple references to the same object—can lead to unintended side effects and bugs. For example, a modification intended for one alias inadvertently alters the shared object, propagating errors across the program and complicating debugging, as seen in issues with concurrent access or unexpected state changes in data structures. Copying mitigates these risks by enabling isolated manipulations, fostering data independence essential for reliable software design. To illustrate, consider the risks of reference assignment versus copying in pseudocode:
// Reference assignment (aliasing)
original = { data: 42 };
copy = original;  // Both point to same object
copy.data = 100;  // original.data is now also 100, causing unintended change
In contrast:
// Actual copying
original = { data: 42 };
copy = clone(original);  // Independent duplicate
copy.data = 100;  // original.data remains 42
Without copying, operations on recursive structures, such as a list referencing itself, can trigger infinite loops during traversal or duplication if aliases are not handled. Primary methods include shallow and deep copies, which differ in recursion depth for nested objects.

Object References and Mutation

In , objects are entities that encapsulate a unique , state (comprising attributes or fields storing data), and behavior (defined by methods that operate on the state). These objects are represented in as contiguous regions allocated at specific addresses, which establish their distinct regardless of their content or usage. References to objects function as pointers or handles that enable indirect access to the object's location, allowing variables to refer to the object without embedding its full data. Assignment of one to another creates aliases, where multiple variables point to the identical region, facilitating shared access but not duplicating the object itself. When objects are mutable, alterations to their state via one propagate across all aliases, leading to unintended side effects. For example, in , consider two variables referencing the same list:
python
my_list = [1, 2]
alias_list = my_list
alias_list.[append](/page/Append)(3)
print([my_list](/page/python))  # Outputs: [1, 2, 3]
Here, the operation modifies the shared list in place, affecting both variables since they reference the same . Similar effects occur with mutable fields like arrays in , where changes through one alias update the structure for all. Immutable objects, by contrast, cannot have their state modified after creation; operations that seem to alter them instead generate new objects with updated values, thereby eliminating risks from —examples include strings in and . However, the discussion here centers on mutable objects, where such shared mutability often necessitates careful management to prevent bugs. Conceptually, the memory layout for shared objects depicts multiple arrows converging on a single block (e.g., at 0x1000 containing a list [1, 2]), illustrating and potential propagation. Independent objects, in comparison, occupy separate blocks (e.g., one at 0x1000 and another at 0x2000 with identical initial content), ensuring isolated mutations. These dynamics of references and underscore the challenges of unintended sharing, motivating object copying as a means to produce isolated instances.

Copying Techniques

Shallow Copy

A shallow copy is a duplication technique in that creates a new object instance while copying only the top-level attributes or fields by value, leaving any nested objects or references to point to the same underlying data as the original. This results in the new object sharing internal structures with the source, effectively creating aliases for mutable subcomponents rather than independent copies. In languages like , this is implemented via the copy.copy() function, which constructs a new compound object and inserts references to the original's nested elements. Similarly, in , the Object.clone() method performs a shallow copy by bit-copying the object's fields without recursing into referenced objects, provided the class implements the Cloneable interface. The mechanism involves allocating for a new object of the same and then assigning the values of fields directly while preserving pointers to nested objects. This approach avoids deep traversal of the object graph, making it a surface-level replication. A representative example illustrates this process:
function shallow_copy(original):
    copy = new Object()  // Create new instance of original's [class](/page/Class)
    for each [field](/page/Field) in original's fields:
        if [field](/page/Field) is [primitive](/page/Primitive):
            copy.[field](/page/Field) = original.[field](/page/Field)  // Direct value copy
        else:
            copy.[field](/page/Field) = original.[field](/page/Field)  // Shared [reference](/page/Reference)
    return copy
This highlights how references to nested objects are not duplicated, ensuring the copy operates on the originals for . Shallow copying offers significant advantages in and resource usage, as it requires less time and compared to full duplication, especially for objects with immutable nested components or large shared substructures that do not need independent modification. It is particularly beneficial in scenarios involving frequent duplications of simple or flat data structures, where the overhead of recursive copying would be unnecessary. However, a key drawback arises with mutable nested objects: alterations to these shared elements propagate to both the original and the copy, potentially introducing subtle bugs or unintended side effects in programs relying on object isolation. Developers must therefore ensure that shared references align with the intended semantics to avoid such issues. Common use cases for shallow copying include duplicating configuration objects where nested settings are immutable or deliberately shared across instances, as well as creating temporary views of data structures like or dictionaries without altering the underlying elements. It proves ideal for flat objects lacking deep nesting or when performance constraints prioritize speed over complete independence, such as in caching mechanisms or lightweight data snapshots. In contrast to deep copy, which extends this by recursively duplicating all nested structures for total autonomy, shallow copy emphasizes pragmatic efficiency for appropriately structured data.

Deep Copy

A deep copy operation recursively duplicates an entire object graph, creating independent copies of all nested objects to ensure that modifications to the copy do not affect the original or vice versa. This mechanism involves traversing the object's structure, cloning primitive values directly and recursively copying composite objects such as arrays or other instances, while updating all internal references to point to the newly created duplicates. Unlike a shallow copy, which only replicates the top-level object and shares references to nested structures, a deep copy provides complete isolation but at greater computational expense. The algorithm typically employs a depth-first traversal of the , starting from the object and recursively each referenced object. To handle circular , which could otherwise lead to infinite , implementations maintain a visited set or map that tracks already-processed objects and reuses their copies when encountered again. Breadth-first traversal is an alternative but less common due to the recursive nature of object nesting. The time and is O(n), where n represents the total number of objects and in the graph, as every element must be visited and duplicated. Here is a representative pseudocode outline for a recursive deep copy function that handles cycles using a map to associate original objects with their copies:
[function](/page/Function) deep_copy(obj, visited_map):
    if obj is [primitive](/page/Primitive) (e.g., int, string, null):
        return obj  // Copy by value
    if visited_map contains obj:
        return visited_map[obj]  // Reuse existing copy to handle cycles
    if obj is array or collection:
        copy = new empty collection of same type
    else:
        copy = new instance of obj's [class](/page/Class)
    visited_map[obj] = copy  // Mark as visited
    for each [field](/page/Field) in obj:
        if field is reference:
            copy.field = deep_copy(obj.field, visited_map)
        else:
            copy.field = obj.field  // Primitive copy
    return copy
This approach ensures the copy is fully independent while preventing stack overflow from cycles. Deep copying guarantees no shared state between the original and duplicate, making it ideal for scenarios requiring isolated computations, such as or data where immutability is critical. It prevents unintended side effects from mutations, ensuring the integrity of the original object across multiple uses. However, deep copying incurs high computational costs due to the need to duplicate the entire , leading to increased time and memory usage proportional to the object's size, which can be prohibitive for large or deeply nested structures. Without proper , it risks infinite in graphs with loops, potentially causing stack overflows or excessive . Special cases in deep copying distinguish between primitives, which are copied by value without recursion (e.g., integers or booleans remain unchanged duplicates), and composite objects like lists or custom classes, which trigger recursive cloning of their contents. For objects with special behaviors, such as proxies that intercept operations, the algorithm may require custom cloning logic to preserve functionality, though standard implementations focus on direct field traversal. Cycles are resolved by the visited map, mapping originals to copies to break loops without duplication.

Hybrid Approaches

Hybrid approaches in object copying combine shallow and deep techniques to selectively replicate object graphs, applying shallow copying to immutable or shared components while using deep copying for mutable elements that require independence. This selective depth allows for efficient handling of complex structures where full deep copying would be overly resource-intensive, and pure shallow copying could lead to unintended side effects from shared references. For instance, in managing hierarchical data on accelerators, base objects are shallow copied alongside targeted sub-objects that undergo deep copying to focus resources on relevant portions. A practical example involves copying a structured object like a product, where the top-level attributes are shallow copied to retain efficiency, but nested components such as associated are deeply cloned to ensure modifications to category details do not propagate back to the original. This mirrors scenarios in serialization-based , where only specific nested objects implement mechanisms like Serializable to enable deeper replication. Implementation techniques include manual selective recursion in methods like clone() to target specific fields. In high-performance computing frameworks, such as OpenACC for GPU data management, selective deep copying optimizes transfers by deeply cloning only essential sub-structures, demonstrating their utility in environments with partially shared state. These methods offer significant advantages by minimizing the computational and overhead of exhaustive copies—potentially reducing times in distributed systems—while mitigating the risks inherent in shallow copies, thus providing a tailored balance for performance-critical applications. Nevertheless, hybrid approaches introduce challenges, including heightened implementation complexity from defining and enforcing selection rules, and the risk of inconsistent object behavior if partial sharing leads to overlooked dependencies across the graph. In real-world contexts like frameworks, such as OpenACC for GPU , selective copying optimizes transfers by deeply cloning only essential sub-structures, demonstrating their utility in environments with partially shared state.

Optimization Strategies

Lazy Copy

Lazy copying, also known as lazy cloning, is an optimization technique in object-oriented programming that combines the efficiency of shallow copying with the independence of deep copying by deferring the duplication of nested objects until a modification is required. It begins with a shallow copy of the object, where references to nested mutable objects are shared, but uses a reference counter for each shared nested object to track the number of copies referencing it. Only when a write operation is attempted on a shared nested object (and the counter indicates multiple references), a deep copy of that specific nested structure is performed, ensuring isolation for the modification while allowing unchanged parts to remain shared. The algorithm for lazy copying typically involves: creating an initial shallow copy and incrementing reference counters on all shared nested objects; on a write access to a nested object, checking its reference counter—if greater than 1, creating a private deep copy of that object (decrementing the original's counter and incrementing the new copy's), then performing the write on the private copy; reads always use the shared reference without copying. This approach avoids the full upfront cost of deep copying and the risks of permanent shallow sharing, using semantics at the object level. One primary advantage of lazy copying is improved and for scenarios where copies are often read but rarely modified, as shared reads incur no overhead and only modified paths are duplicated. However, it introduces complexity in managing reference counters, potential overhead from counter checks on writes, and challenges in concurrent settings where updates to counters are needed to prevent race conditions. The roots of lazy copying trace back to operating system process management, such as the Unix fork() system call, which efficiently creates process copies by deferring memory duplication until writes occur via copy-on-write, a concept adapted to finer-grained object-level operations in programming languages. As an illustrative example, consider the following pseudocode for lazy copy using reference counting on nested objects:
function lazyCopy(original) {
    let clone = shallowCopy(original);  // Initial shallow copy
    for each nestedRef in clone.referenceFields {
        incrementRefCount(nestedRef);  // Track sharing
    }
    return clone;
}

function writeToNested(clone, prop, value) {
    let nested = clone.referenceFields[prop];
    if (getRefCount(nested) > 1) {
        let privateNested = [deep](/page/Deep)Copy(nested);
        decrementRefCount(nested);
        incrementRefCount(privateNested);
        clone.referenceFields[prop] = privateNested;
        nested = privateNested;
    }
    nested.value = value;  // Write to (possibly new) private copy
}
This ensures shared reads are efficient and mutations trigger isolated deep copies only as needed.

Copy-on-Write

Copy-on-write (COW) is a technique that allows multiple processes or threads to share the same block initially, deferring the creation of a private copy until a write operation is attempted on the shared data. This mechanism is particularly useful in scenarios where data is frequently read but rarely modified, as it avoids unnecessary duplication of unchanged content. In implementation, COW relies on virtual memory hardware features such as page protection, where shared pages are marked as read-only to trigger a or operating system signal (e.g., SIGSEGV in systems) upon a write attempt. The operating system handler then allocates a new private page for the modifying , copies the original content into it, updates the mappings, and allows the write to proceed on the copy, ensuring isolation without affecting other sharers. This approach integrates with the (MMU) to enforce the write trap efficiently at the hardware level. The primary advantages of COW include significant memory savings in fork-heavy workloads, such as process creation in operating systems, where only entries are duplicated initially rather than the full . It also facilitates efficient immutable in databases and supports snapshot creation with minimal overhead for read-mostly operations. However, COW requires underlying operating system and hardware support for page mechanisms, which may not be available in all environments. Drawbacks include potential memory fragmentation from scattered private copies and increased costs if writes occur frequently, leading to repeated copying and higher latency. COW finds applications in language runtimes like the (JVM), where classes such as CopyOnWriteArrayList use it for thread-safe array handling by creating a new copy of the underlying array only on mutations, allowing concurrent reads without locks. In file systems, employs COW to enable atomic updates, snapshots, and by writing modifications to new locations while preserving the original data blocks. A representative example in multithreading involves multiple threads accessing a shared list of elements; under COW, all threads initially reference the same array for reads, but when one thread modifies an element, it triggers a full copy of the array for that thread's private use, ensuring other threads continue reading the unmodified version without interruption. This approach, related to but distinct from higher-level lazy copying, optimizes for scenarios with high read concurrency and infrequent updates.

Language-Specific Implementations

In Java

In Java, object copying is supported through the clone() method defined in the Object class, which by default performs a shallow copy by creating a new object and copying all the fields of the original object at the bit level. This means primitive fields are fully duplicated, but reference fields point to the same objects as in the original, potentially leading to shared mutable state. To enable cloning, a class must implement the Cloneable marker interface; without it, invoking clone() results in a CloneNotSupportedException. The Cloneable interface itself provides no methods but serves as a signal to the JVM that cloning is permitted for that class. For deep copying, where nested objects are also duplicated, developers must override the clone() method and explicitly clone mutable reference fields, such as collections or custom objects. A common implementation calls super.clone() to obtain the shallow copy and then manually duplicates nested structures. For example, consider a Person class with a name and a list of addresses:
java
import java.util.ArrayList;
import java.util.List;

public class Person implements Cloneable {
    private String name;
    private List<String> addresses;

    public Person(String name, List<String> addresses) {
        this.name = name;
        this.addresses = new ArrayList<>(addresses);
    }

    @Override
    public Person clone() throws CloneNotSupportedException {
        Person cloned = (Person) super.clone();
        cloned.addresses = new ArrayList<>(this.addresses);  // Deep copy the list
        return cloned;
    }

    // Getters and setters omitted for brevity
}
In this overridden method, the list is cloned using ArrayList's copy constructor to avoid sharing the original collection's elements. Failure to do so results in both the original and clone referencing the same list, allowing mutations in one to affect the other—a frequent pitfall with collections. Despite its availability, implementing Cloneable and overriding clone() is discouraged in modern due to its complexity, error-proneness, and historical issues, including vulnerabilities where untrusted inputs can exploit to bypass immutability or access controls. Best practices recommend alternatives like copy constructors or static factory methods for controlled , ensuring proper handling of CloneNotSupportedException and adherence to the contract by calling super.clone() first to avoid subclass inconsistencies. Additionally, overriding clone() without proper safeguards can lead to incomplete copies, such as neglecting to clone elements within collections, perpetuating shared state bugs. For more robust deep copying, libraries like Apache Commons Lang offer SerializationUtils.clone(), which serializes the object to a byte stream and deserializes it, producing an independent copy of the entire object graph—provided all components implement Serializable. This approach handles nested structures automatically but incurs performance overhead from serialization and requires careful management of transient fields. At the JVM level, provides a mechanism for generic object by inspecting and setting s dynamically, often used in frameworks for bean-to-bean . For instance, libraries like BeanUtils employ via PropertyUtilsBean to copy properties between objects, bypassing the need for Cloneable. However, reflection-based is slower than direct field access and can violate encapsulation by accessing private s, so it should be used judiciously. Regarding garbage collection, cloned objects allocate new heap space independently of the originals, potentially increasing short-term memory pressure until the JVM's collector (e.g., G1 or ZGC) reclaims unused instances, but this separation ensures mutations do not indirectly affect reachability analysis.

In Python

Python's standard library includes the copy module, which provides functions for creating shallow and deep copies of objects to facilitate independent modifications without affecting the originals. The primary functions are copy.copy(), which produces a shallow copy by duplicating the top-level object while preserving references to nested mutable objects, and copy.deepcopy(), which recursively copies all nested objects to create a fully independent structure. Built-in mutable types such as lists and dictionaries support shallow copying through methods like slicing (lst[:]) for lists or dict.copy() for dictionaries, which create new containers with references to the original elements. For custom classes, developers can implement the special methods __copy__() to define shallow copying behavior or __deepcopy__(memo) to customize deep copying, allowing tailored handling of instance attributes. The deepcopy() function includes built-in cycle detection via an optional memo dictionary, which tracks already-copied objects to prevent infinite recursion in structures with circular references. For example, consider a nested representing a :
python
import copy

original = {'outer': {'inner': [1, 2, 3]}}
copied = copy.deepcopy(original)
copied['outer']['inner'].append(4)
print(original['outer']['inner'])  # Output: [1, 2, 3] (unchanged)
This demonstrates how deepcopy() ensures the original remains unmodified. However, deepcopy() may raise exceptions for unpicklable objects, such as file handles or certain C extensions, as it relies on a serialization-like process to traverse and duplicate objects. Deep copying incurs significant performance overhead for large or deeply nested structures due to the recursive traversal and duplication required, often making it slower than shallow copying by factors of several times in benchmarks. For serializable data like dictionaries without custom objects, alternatives such as serializing with [json.dumps()](/page/JSON) followed by [json.loads()](/page/JSON) can achieve a similar deep copy effect with potentially better performance in some cases, though they lose non-JSON-compatible types. Python lacks native support for lazy copying or mechanisms in its core object model, relying instead on third-party libraries like those implementing CoW in specialized contexts (e.g., dataframes) for such optimizations.

In Other Languages

In C++, object is primarily handled through copy constructors, which create a new object by copying the data members of an existing one; these can implement either shallow copying, where pointers or references are duplicated without copying the pointed-to data, or , where the underlying data is recursively duplicated to avoid shared ownership issues. For polymorphic classes, a common pattern involves defining a virtual clone() method in the base class, allowing derived classes to override it and return a pointer to a dynamically allocated copy of the appropriate derived type, ensuring type-safe copies without slicing. The (RAII) idiom, central to C++ , implies that copy constructors must carefully handle resource ownership, often requiring copies for unique resources like handles or dynamically allocated to prevent leaks or double-free errors upon destruction. JavaScript provides Object.assign() as a standard method for shallow copying, which enumerates and copies enumerable own properties from one or more source objects to a target object, but it does not recurse into nested objects, leading to shared references for complex structures. For deep copying, the modern structuredClone() API, introduced in 2022, creates a full recursive clone of an object using the structured clone algorithm, supporting cycles, certain built-in types like Dates and RegExps, and transferable objects, while throwing errors for unsupported types like functions. In and , object copying revolves around cons cells, the fundamental building blocks for lists and trees; nondestructive operations like copy-list in or list-copy in Scheme create new cons cells that share structure with the original where possible, preserving immutability and enabling efficient sharing without full duplication. Destructive operations, such as nconc or rplaca, modify existing cons cells in place for performance, but they are used cautiously to avoid side effects, with Scheme's functional style often favoring nondestructive variants to maintain . Eiffel distinguishes assignment, which copies references to existing objects without duplication, from explicit cloning via the twin() feature for shallow copies, which duplicates the object's immediate fields but shares nested references, and cloned() or deep_twin() for deep copies that recursively duplicate the entire structure. mechanisms allow developers to specify preconditions, postconditions, and for these copy operations, ensuring that clones maintain the behavioral semantics of the original, such as or invariant properties, through runtime assertions. Across languages, common patterns in object copying reflect differences between garbage-collected environments, which automate reclamation and favor to reduce overhead, and systems, where explicit deallocation necessitates careful copy semantics to avoid dangling pointers. In , the ownership model minimizes copies altogether by enforcing unique ownership and borrowing rules, allowing immutable references (&T) for read-only access or mutable references (&mut T) without transfer, thus avoiding duplication unless explicitly invoked via implementation. Recent trends in functional languages like emphasize immutable data structures, where "copies" are often structural via persistent data types, drastically reducing the need for explicit copying operations and enabling efficient updates through path copying only for modified parts.

References

  1. [1]
    Deep, Shallow and Lazy Copy with Java Examples - GeeksforGeeks
    Jun 13, 2022 · In object-oriented programming, object copying is creating a copy of an existing object, the resulting object is called an object copy or ...
  2. [2]
  3. [3]
    Shallow and deep copy: Two ways to copy objects in Java - InfoWorld
    Jan 4, 2024 · Shallow copy copies simple values, sharing internal object references. Deep copy creates new copies of internal objects, making them ...
  4. [4]
  5. [5]
  6. [6]
    How to Copy Objects in Python: Shallow vs Deep Copy Explained
    Apr 21, 2025 · Shallow copying creates a new object but references the same nested objects, leading to shared changes. Deep copying recursively duplicates all ...
  7. [7]
    Shallow Copy and Deep Copy in C++ - GeeksforGeeks
    Jul 23, 2025 · In general, creating a copy of an object means to create an exact replica of the object having the same literal value, data type, and resources.
  8. [8]
    [PDF] History of Lisp - John McCarthy
    Feb 12, 1979 · Some of the most evident in the early 1960s were ultra-slow numerical computation, inability to represent objects by blocks of registers and ...
  9. [9]
    [PDF] Lisp
    Lisp was invented by John McCarthy, who also invented the term ... of Common Lisp functions like copy-list and copy-tree. The former copies a ...
  10. [10]
    Data representation 2: Object representation – CS 61 2018
    The C++ abstract machine concerns the construction and modification of objects. An object is a region of memory that contains a value, such as the integer 12.Missing: oriented | Show results with:oriented
  11. [11]
    1.2 Data Abstraction - Algorithms, 4th Edition
    Jun 12, 2020 · This situation is known as aliasing: both variables refer to the same object. ... identity: whether the references are equal. Typical clients ...
  12. [12]
    Reading 9: Mutability & Immutability - MIT
    Immutable objects aren't susceptible to bugs caused by aliasing. Immutable references always point to the same object. Easy to understand. Because an immutable ...
  13. [13]
    6.2 Objects and Object Mutation
    In Python, object mutation (often shortened to just mutation) is an operation that changes the value of an existing object.
  14. [14]
    copy — Shallow and deep copy operations
    ### Summary of `copy` and `deepcopy` Functions in Python
  15. [15]
    Object (Java SE 17 & JDK 17)
    ### Summary of `clone()` from java.lang.Object
  16. [16]
    [PDF] Pointers and Memory - Stanford CS Education Library
    ... shallow copy, so they know not to change or delete it since it is shared. The alternative where a complete copy is made and sent is known as a "deep" copy.
  17. [17]
    Differences Between a Deep Copy and a Shallow Copy - Baeldung
    Mar 18, 2024 · In essence, a shallow copy is more efficient but shares references to existing nested objects. Therefore, it is ideal for quick duplication or ...
  18. [18]
  19. [19]
    Array Data Structure - andrew.cmu.ed
    If we want a "deep" copy instead, we must provide our own implementation by overriding Object's clone() method. The idea of a "deep" copy is simple - it makes a ...
  20. [20]
    [PDF] Summary of C++ Data Structures - Clemson University
    Instead a deep copy produces a completely separate object. class Foo ... default assignment operator, which is a shallow copy—only the declared variables.
  21. [21]
    [PDF] Assessing Performance Implications of Deep Copy Operations via ...
    Jun 3, 2019 · In some cases, a selective deep copy is sufficient when only a subset of the fields of the data structure on the device is of our interest [3].
  22. [22]
    [PDF] Complex Data Management in OpenACC Programs
    First, selective deep-copy transfers a base object and a sub-object; then, another sub-object is attached to that data structure; finally, that sub-object ...
  23. [23]
    (PDF) Lazy Clone -A Pattern to Improve Performance and ...
    Listing 1: Lazy cloning implementation with dynamic proxies. 1public class LazyObjectProxyCloner <T> {. 2pr i ...
  24. [24]
    [PDF] A fork() in the road - Microsoft
    There was no Unix-style copying of the address space, likely because virtual memory hardware was available.2. Unix fork was not a necessary “inevitability” [61] ...
  25. [25]
    [PDF] mach.pdf - cs.Princeton
    As in. Accent, copy-on-write sharing is used to efficiently perform virtual memory copying both during task creation and during message transfer. Table 3-3 ...
  26. [26]
    [PDF] Effects of copy-on-write memory management on the response time ...
    ''Copy-on-write'' paging strategies for address space inheritance have been shown to be effective in reducing the real time required to perform UNIX fork() ...
  27. [27]
    [PDF] EE108B Lecture 14 Virtual Memory - Stanford University
    “copy” of the current address space. • Often implemented using copy-on-write. – Second process has read-only access to the page. – If second process wants to ...
  28. [28]
    [PDF] A New Approach To Real-Time Checkpointing - USENIX
    When a checkpoint operation is requested by an application or by the system using copy-on-write, 16,384 pages are immediately made write-protected. From this ...
  29. [29]
    [PDF] TotalCOW: Unleash the Power of Copy-On-Write for Thin ...
    Modern file systems leverage the Copy-on-Write (COW) technique to efficiently create snapshots. COW can signif- icantly reduce demand on disk space and I/O ...
  30. [30]
    CopyOnWriteArrayList (Java Platform SE 8 ) - Oracle Help Center
    A thread-safe variant of ArrayList in which all mutative operations ( add , set , and so on) are implemented by making a fresh copy of the underlying array.
  31. [31]
    BTRFS - The Linux Kernel documentation
    Btrfs is a copy on write filesystem for Linux aimed at implementing advanced features while focusing on fault tolerance, repair and easy administration.
  32. [32]
    Object (Java Platform SE 8 )
    ### Summary of `clone()` Method from `java.lang.Object`
  33. [33]
    Cloneable (Java Platform SE 8 ) - Oracle Help Center
    A class implements the Cloneable interface to indicate to the Object.clone() method that it is legal for that method to make a field-for-field copy of ...
  34. [34]
    How to Make a Deep Copy of an Object in Java | Baeldung
    Mar 26, 2025 · Learn four ways to create a deep copy of an object in Java, and why to prefer a deep copy over a shallow copy.Missing: selective | Show results with:selective
  35. [35]
    CWE-580: clone() Method Without super.clone() - MITRE Corporation
    All implementations of clone() should obtain the new object by calling super.clone(). If a class does not follow this convention, a subclass's clone() ...
  36. [36]
    SerializationUtils (Apache Commons Lang 3.11 API)
    Assists with the serialization process and performs additional functionality based on serialization. Deep clone using serialization; Serialize managing ...
  37. [37]
    Using Java Reflection - Oracle
    Reflection is a feature in the Java programming language. It allows an executing Java program to examine or "introspect" upon itself, and manipulate internal ...
  38. [38]
    Copy-on-Write (CoW) - Pandas - PyData |
    A new lazy copy mechanism that defers the copy until the object in question is modified and only if this object shares data with another object.
  39. [39]
    C++: Polymorphic Cloning and the CRTP (Curiously Recurring ...
    Aug 23, 2013 · The solution is to use the commonly-used polymorphic cloning pattern. In this pattern, we define a virtual function – which we'll call clone() in this article.Missing: method | Show results with:method
  40. [40]
    Object.assign() - JavaScript - MDN Web Docs
    Jul 10, 2025 · The Object.assign() static method copies all enumerable own properties from one or more source objects to a target object. It returns the modified target ...Try it · Syntax · Description · Examples
  41. [41]
    Window: structuredClone() method - Web APIs | MDN
    Jul 20, 2025 · The structuredClone() method of the Window interface creates a deep clone of a given value using the structured clone algorithm.
  42. [42]
    Associations - MIT Scheme Reference
    The association table is MIT Scheme's equivalent to the property lists of Lisp. ... The implementation provides non-destructive operations. There is a ...Hash Tables · Low-Level Hash Table... · Basic Hash Table Operations
  43. [43]
    Universal class and its features - Eiffel
    Note: In some existing Eiffel code you may encounter the use of a function clone which is used to do the job of twin , but has a form like copy , as in target.
  44. [44]
    [PDF] 21 Comparing and duplicating objects
    For both copying and cloning, the default variants are “shallow”, affecting only one object, but deep versions are available to duplicate an object structure ...