Glulx: protecting a variable amount of data

In Glulx, what is the proper way to protect a variable amount of data from, say, @undo? @protect lets me set the protected memory range, but I don’t see a way to read it back.

There’s some extensions which muck with undo. Maybe they hide an answer? Hypothetical Questions is one of them. Others have “undo” in their name…

I don’t know, sorry.

By “read it back”, you mean discover how much memory was saved? You’d have to store a data structure that declares its own length somehow. Say, an array of values whose first value is the length of the array.

Sorry, I should have worded my question less hastily. I was hoping to protect a malloc made after a saveundo, in which case I would need not only its extent, but also its position. But looking at the git source code, it seems that even protected mallocs are destroyed if they didn’t exist at the restore point. I suppose that I need to use an external file.