I tried to close a PDA account that has changed in structure, but ran into:

"Error: memory allocation failed, out of memory"

  • If you're failing to allocate memory during the program, you might be using too many accounts without zero-copy serialization or too much heap-allocated state in general
    – Jon C
    Mar 4 at 13:23

1 Answer 1


I used to specify close = destination in the anchor macro but it did not work.

So I ended up copying the code from here to close the account and passing in UncheckedAccount:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.