XD using 28 gigs of ram

I have no idea why is this happening. I was working on my plugin and was idle for like 10 minutes I come back and see this. I kill XD, restart and everything seems normal now. The same thing has happened to me couple of times now and to the point where i cannot do anything without killing XD.
machine specs: https://jmp.sh/IBjvDCK
windows version: windows 10 pro build(18363)
usage screenshot: https://jmp.sh/DO9Gtq6

As discussed separately, it’s possible your plugin or other plugins go into some kind of infinite loop and causes XD to use up a lot of memories. Please, others chime in if you’ve seen something similar

1 Like

Wow! That’s… amazing! XD should be crashing well before it reaches 28GB.

A few things I can think of:

  • Plugin in an infinite loop, allocating memory, but never releasing it?
  • Lots of exports with exportRendition?
  • Recreating millions of DOM elements in fast sequence (without deleting them from the DOM)?
2 Likes

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

No; UXP does not currently have a watchdog timer to deal with hung plugins. We’re working on some stuff that will allow activity monitoring (a bit like Chrome has for tabs), but that’s still a ways off.

3 Likes

Thanks a lot everyone for the helping i figured out the error it was a react component that indefinitely remounting