X Tutup
The Wayback Machine - https://web.archive.org/web/20260215030409/https://github.com/RustPython/RustPython/issues/2046
Skip to content

Memory cannot be recycled correctly when object is referenced circularly #2046

@comradeHsu

Description

@comradeHsu

my test code:
`class A:
def init(self,name,ref):
self.name = name
self.ref = ref
self.data = [0]*1000000

class B:
def set_ref(self,ref):
self.ref = ref

def test():
while True:
b = B()
a = A("name",b)
b.set_ref(a)

print("Hello, RustPython!")
test()`

the error message:
memory allocation of 16000000 bytes failed
error: process didn't exit successfully: target\release\rustpython.exe demo.py (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

I want to know how we design the object model, because I found that it can clear some memory when I test. I'm also trying to write the JVM with rust, but I can't solve the problem of circular reference. I hope I can get inspiration from you

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup