XD using 28 gigs of ram

It sounds like an infinite loop and unreleased memory.

Does UXP have a script timeout limit? I think the browsers show a prompt if a script runs over a certain amount of time.

I was able to break up large loops by using promises to allow the user to cancel the operation if it’s taking too long.

In the log utilities you can use a pseudo sleep function:

async function myProcessorIntensiveFunction(data) {
	let commands = require("commands");

	var items = [];

	// do stuff
	for(var index=0; index < items.length; index++) {
		// stuff 

		// give UI a chance to avoid the UI locking up 
		await sleep(1);
		showProgressInfo();

		if (cancelRunningProcess) {
			cancel();
			break;
		}
	}
}

// use async function with await
async function startButtonClickHandler(event) {
	showCancelButton();
	await myProcessorIntensiveFunction(data);
}

// cancel button click handler
async function cancelButtonClickHandler(event) {
	cancelRunningProcess = true;
	hideCancelButton();
}

If you are creating a lot of objects keep track by updating your UI instead of dumping to the console.

1 Like