Raycasting doesn't work after 'fatal error'
Hello. After I've got a fatal error message, the raycasting in my project stopped working properly. The error message was: "Could not allocate memory: System out of memory" and it said, that the allocation happened at line 405 in C:\buildslave\unity\build\Runtime\Allocator\ThreadsafeLinearAllocator.cpp ( maybe that's good to know). The raycast mostly detects nothing, but sometimes it detects an object when I'm right in front of it - and it also happened that it detected an object when there was actually none in front of it. Does someone know, how I can fix this?
Answer by Bunny83 · Jun 14, 2020 at 06:32 PM
When you run out of memory the exact point where the system runs out of memory does not necessarily be the issue at all. Running out of memory is a rather rare case. You probably do something crazy like creating tons of tracked objects (GameObjects, Textures, Materials, Meshes, ...) without properly destroying them. Of course once your system is on the brink of running out of memory any following action that would allocate memory could finally cause the out of memory exception.
Without more details we can't really help you. Have you already used the Profiler to check the memory usage and how it's growing? Debugging is a fundamental part of software development and that can only be done by yourself.
Your answer
![](https://koobas.hobune.stream/wayback/20220613000928im_/https://answers.unity.com/themes/thub/images/avi.jpg)