I am trying to write a vector of objects into a solana account. The problem is, the pre-allocated size of the account might be too small for my vector. I know i can re-size the account with realloc
, but I still don't know the serialized size of my vector of objects, which I need to call realloc.
I could implement my own serialization logic, but I'd prefer not to do that.
Are there any serialization libraries out there that tell you the size of the serialized object before you serialize it?
vec
). However; if you are trying to manage a large vector or it's growth can potentially be large you may want to consider using PDA for whatever info you would store in thevec
. Any serialization is going to consume more CU and that may be prohibitive.