Skip to main content
Inspiring
March 23, 2023
Answered

Purging Undo Cache

  • March 23, 2023
  • 1 reply
  • 982 views

Hi,

Is it possible to purge the Undo Cache via Script or SDK? I'm dealing with quite heavy files, duplicating, moving around, making clipping masks etc. 32GB Ram fills up and crashes some documents. I'm confident that it's the undos that's eating the Ram because twice as much Ram is being used when I change from 50 to 100 Undos in the settings.

 

Thanks!

(I posted a version of this about 5 years ago, but didn't get a definite answer back then.)

This topic has been closed for replies.
Correct answer iLLMonkey

It's been there going back at least 15 years, but I just checked and apparently they changed the API at some point. In CS6, it was:

 

AIAPI AIErr (*PurgeAllUndos) ( void );

 

But in CS6, it was marked as deprecated, so I guess they eventually replaced it with ClearHistory().


Thank you! Got the "newest" SDK to work and with that also the ClearHistory and ForgetRedos so it's all good now. In my "old" 2020 SDK reference manual those functions are omitted. They also got red-lined in my IDE. weird.

1 reply

A. Patterson
Inspiring
March 23, 2023

You can purge it with the SDK for sure, I've done it. From AIUndo.h:

	/**	Forgets all redoable transactions.
		Any redos available at this point are forgotten.
		This decreases the available redo transactions to 0.
		@param document The document on which to perform the operation..
	 */
	AIAPI AIErr (*ForgetRedos) ( AIDocumentHandle document );

	/**	Forgets all future transactions and commits all
		current and past transactions. Post this the transaction
		queue is empty.  */
	AIAPI AIErr (*ClearHistory) ( AIDocumentHandle document );

 

iLLMonkeyAuthor
Inspiring
March 23, 2023

Awesome!, I didn't find it in my manual since I'm stuck with the 2020 SDK. Theese functions seem to be brand new. Going to try to get the Newer SDK to run, I'm eager to try this.

A. Patterson
Inspiring
March 23, 2023

It's been there going back at least 15 years, but I just checked and apparently they changed the API at some point. In CS6, it was:

 

AIAPI AIErr (*PurgeAllUndos) ( void );

 

But in CS6, it was marked as deprecated, so I guess they eventually replaced it with ClearHistory().