pmem_save - Save persistent memory


void pmem_save();
void pmem_save(uint8 slot_no);

Save the contents from the RAM structure that mirrors the persistent memory to the actual persistent memory correlated with current memory slot, or with slot_no.

pmem_save() should be called at least once after modify the contents using pmem_write(), so the modified data can be accessible on subsequent executions of the GPC script.

Optional Parameter

  • slot_no: A valid memory slot number, between 1 and 9.

Return Value

No value is returned.

Persistent Memory

Persistent Memory Flow

The persistent memory is an array of 128 bytes that can be used to store data structures such that they can continue to be accessed even after the end of the GPC script that created or last modified them.

For performance reasons the operations pmem_read() and pmem_write() are performed in RAM, therefore the persistent memory contents should first be loaded into RAM space by pmem_load() and, if modified, saved with pmem_save().


Example #1 pmem_save() example

void set_pvar(uint8 idx, int16 val) {
    pmem_write(idx, val);

See Also

t2/pmem_save.txt · Last modified: 2017/03/20 11:57 by J2Kbr