Skip to content

Memory leak in WeakMap #1015

Closed
Closed
@kasonyang

Description

@kasonyang

Hi, I found a new bug in weak map. A key can not be free when it is only referenced by it's value.

For example:

const map = new WeakMap();

function test() {
    const k = {
        text: "a".repeat(1000)
    };
    map.set(k, {k});
    os.setTimeout(test, 0);
}

test();

Another example(build with webpack)

import {ref} from "@vue/runtime-core";

const sysInfo = ref({});

async function updateInfoLoop() {
  sysInfo.value = {
      time: new Date(),
  };
  setTimeout(updateInfoLoop, 16);
}

updateInfoLoop();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions