From 1193965b926d6752eb85a78dbe373be6caa1728e Mon Sep 17 00:00:00 2001 From: Paul Schaaf Date: Wed, 23 Mar 2022 18:12:34 -0400 Subject: [PATCH] add comment about zero-copy in space chapter --- src/chapter_5/space.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/chapter_5/space.md b/src/chapter_5/space.md index 7fcbed8..e8aff7d 100644 --- a/src/chapter_5/space.md +++ b/src/chapter_5/space.md @@ -1,6 +1,8 @@ # Space Reference This reference tells you how much space you should allocate for an account. +This only applies to accounts that don't use `zero-copy`. `zero-copy` uses `repr(C)` with a pointer cast, +so there the `C` layout applies. In addition to the space for the account data, you have to add `8` to the `space` constraint for Anchor's internal discriminator (see the example).