Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined error when using measureUserAgentSpecificMemory #30

Open
MajidBabaeifar opened this issue Oct 5, 2023 · 0 comments
Open

undefined error when using measureUserAgentSpecificMemory #30

MajidBabaeifar opened this issue Oct 5, 2023 · 0 comments

Comments

@MajidBabaeifar
Copy link

MajidBabaeifar commented Oct 5, 2023

Hello ,
I am trying to measure the application memory usage when running some OpenCV functions. I tried to use the new API performance.measureUserAgentSpecificMemory() but I get undefined error.
this is how I tried to use it:

if (!window.crossOriginIsolated) {
            console.log("performance.measureUserAgentSpecificMemory() is only available in cross-origin-isolated pages");
        } else if (!performance.measureUserAgentSpecificMemory) {
            console.log("performance.measureUserAgentSpecificMemory() is not available in this browser");
        } else {
            let result;
            try {
                result = await performance.measureUserAgentSpecificMemory();
            } catch (error) {
                if (error instanceof DOMException && error.name === "SecurityError") {
                    console.log("The context is not secure.");
                } else {
                    throw error;
                }
            }
            console.log(result);
        }
        if (this._isVisualizable(imageMat)) {
            cv.imshow(canvasSource, imageMat.Mat);
            return;
        }

This code gives me some build time errors and I also have problem with typescript when using this API.
I use webpack and React. Please ask me if you need any further information.
I appreciate some guidance or a better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant