Storage of Field Values within Messages
Values stored in a message field are part of the message, that is, they reside in memory associated with the message, and allocated by the library.
When a field’s type is a primitive type, calls that get the field’s value copy that value from the message. In contrast, when a field’s type is non-primitive, calls that get the field’s value return a pointer to memory within the message. (The fourth column of the table in Field Data Type Reference indicates primitive and non-primitive types.)
Programs must not modify non-primitive values that reside in memory associated with a message. For example, you must not set the value of a cell in a long array extracted from a message.
Furthermore, non-primitive values remain valid only for a limited time: