Skip to content

Commit 4fd1947

Browse files
committed
Update docs
1 parent 3847050 commit 4fd1947

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

docs/modules/ROOT/pages/utilities.adoc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -491,23 +491,6 @@ function processMultipleItems(uint256[] memory items) internal {
491491

492492
This way, memory allocated for `tempData` in each iteration is reused, significantly reducing memory expansion costs when processing many items.
493493

494-
==== Copying memory buffers
495-
496-
The `Memory` library provides a `copy` function that allows copying data between memory locations. This is useful when you need to extract a segment of data from a larger buffer or when you want to avoid unnecessary memory allocations. The following example demonstrates how to copy a segment of data from a source buffer:
497-
498-
[source,solidity]
499-
----
500-
function copyDataSegment(bytes memory source, uint256 offset, uint256 length)
501-
internal pure returns (bytes memory result) {
502-
503-
result = new bytes(length);
504-
Memory.Pointer srcPtr = Memory.addOffset(Memory.contentPointer(source), offset);
505-
Memory.Pointer destPtr = Memory.contentPointer(result);
506-
507-
Memory.copy(destPtr, srcPtr, length);
508-
}
509-
----
510-
511494
IMPORTANT: Manual memory management increases gas costs and prevents compiler optimizations. Only use these functions after profiling confirms they're necessary. By default, Solidity handles memory safely - using this library without understanding memory layout and safety may be dangerous. See the https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_memory.html[memory layout] and https://docs.soliditylang.org/en/v0.8.20/assembly.html#memory-safety[memory safety] documentation for details.
512495

513496
=== Historical Block Hashes

0 commit comments

Comments
 (0)