CosmosOS / Cosmos

Cosmos is an operating system "construction kit". Build your own OS using managed languages such as C#, VB.NET, and more!
https://www.goCosmos.org
BSD 3-Clause "New" or "Revised" License
2.93k stars 553 forks source link

Heap.Collect is completely Broken #2723

Closed stephencomputer closed 1 year ago

stephencomputer commented 1 year ago

Area of Cosmos - What area of Cosmos are we dealing with?

Garbage Collection/GC (Heap)

Expected Behaviour - What do you think that should happen?

Heap.Collect should collect the unreferenced objects and free them.

Actual Behaviour - What unexpectedly happens?

Heap.Collect slows down Cosmos like crazy, but still technically does what it was designed to do.

Reproduction - How did you get this error to appear?

Running Heap.Collect() in the Run loop and also in a loop that scans an image's x and y axises and blurs it. Removing Heap.Collect causes a kernel panic, too.

Version - Were you using the User Kit or Dev Kit? And what User Kit version or Dev Kit commit (Cosmos, IL2CPU, X#)?

The latest Dev Kit (My only change is a modified DrawImageAlpha that scales the said image)

stephencomputer commented 1 year ago

UPDATE: it seems heap.collect doesn't even do anything but slow down the system. I am still facing 0x103 kernel panics even after using the method every five frames.

stephencomputer commented 1 year ago

https://paste.md-5.net/guyaduxibu.cs take a look at my code

valentinbreiz commented 1 year ago

Use https://github.com/CosmosOS/Cosmos/pull/2710