Do I have to dispose Parse instances to avoid memory leaks?

I have multiple helper functions on frontend where I initialize Parse, and then run a cloud function. They look like this:

const Parse = (await import("parse")).default;

export async function cancelOperation({ operationId }) {
  Parse.initialize(process.env.NEXT_PUBLIC_APP_ID);
  Parse.serverURL = `${process.env.NEXT_PUBLIC_SERVER_URL}/parse`;

  await Parse.Cloud.run("cancelOperation", { operationId });
}

I’m wondering if each of them creates a separate Parse instance that continues to run in the background consuming resources. Is that the case? If so, how can I terminate the instance after I ran the function?

I would go with what the doc says : initialize your Parse at init time.
I’m sure the resources are minimal.

1 Like