diff --git a/README.md b/README.md index a675632..0d330cd 100644 --- a/README.md +++ b/README.md @@ -271,13 +271,13 @@ func main() { heap[1] = 70 heap = allocator.Realloc(alloc, heap, 3) - allocator.FreeMany(alloc, heap) - - heap[3] = 100 + heap[2] = 100 fmt.Println(heap[0]) fmt.Println(heap[1]) - fmt.Println(heap[3]) + fmt.Println(heap[2]) + + allocator.FreeMany(alloc, heap) } ``` diff --git a/allocator/example_test.go b/allocator/example_test.go index 13efd3b..eb90b05 100644 --- a/allocator/example_test.go +++ b/allocator/example_test.go @@ -74,13 +74,13 @@ func ExampleRealloc() { heap[1] = 70 heap = allocator.Realloc(alloc, heap, 3) - allocator.FreeMany(alloc, heap) - - heap[3] = 100 + heap[2] = 100 fmt.Println(heap[0]) fmt.Println(heap[1]) - fmt.Println(heap[3]) + fmt.Println(heap[2]) + + allocator.FreeMany(alloc, heap) // Output: // 15