2

I have a drive file that seems to have a corrupted or leaky realtime document.

When I call realtimeDocument.getModel().getRoot().toString(), the output is {slides: []}, but when I try to insert a new slide (a custom object with 10 or 15 small string properties), I get a size limit error.

Model size limit has been exceeded. Used: 10681723 bytes; Limit: 10485760 bytes

Is there a way I can reinitialize the realtime document or otherwise get it to trim itself down?

This only seems to be happening in one file - all of my other files have reasonable mappings between realtime document size and model complexity.

Riley Lark
  • 20,660
  • 15
  • 80
  • 128

1 Answers1

3

Have you previously created and removed a lot of objects from the document? Currently each CollaborativeObject persists in the model forever. Thus, removing it from the root doesn't actually free up the space. (This is because objects can become reattached to the root via collaborator actions or undo.)

In normal operations this shouldn't generally be a problem, but if you are constantly creating and removing objects you could run into issues.

Cheryl Simon
  • 46,552
  • 15
  • 93
  • 82
  • That explains it - yes, I did upload & delete many slides with large images. This use-case is not totally bizarre for my app - is there a way to manually orphan the realtime doc so it's reinitialized? Or, instead of removing the slides in bulk, can I null out the large string properties and actually reclaim that space? – Riley Lark Mar 12 '14 at 20:42
  • If this is on a shortcut file, there is no way to reset the document unfortunately. In the future nulling out large string or json data would help. The actual collab objects themselves don't take up that much space, so most space would be taken up by any data within them. You just need to be careful to do it in such a way that undo/collaborator actions still work. Maybe group the deletes and remove from root together in a compound operation so they get undone together. – Cheryl Simon Mar 12 '14 at 21:17
  • Ok, that makes sense. I can definitely group the deletes & remove. Thanks a bunch! PS: this is not a shortcut file - I'm writing the JSON from the realtime doc to the file occasionally so that copying works as expected. I guess I could clear the model in this case by using a different app to open a new realtime doc on the same file? – Riley Lark Mar 13 '14 at 01:02
  • Yeah, that could be a hacky workaround. Or just copy the file and start fresh? – Cheryl Simon Mar 13 '14 at 01:13