odin-lang / Odin

Odin Programming Language
https://odin-lang.org
BSD 3-Clause "New" or "Revised" License
6.38k stars 562 forks source link

Odin Compilation Freezes System #2320

Open ghost opened 1 year ago

ghost commented 1 year ago

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Current Behavior

I have a very large array in my program that used to compile, but no longer does.

When compiling, my computer almost completely freezes. The mouse is hardly movable and extremely choppy, freezing frequently for a couple of seconds at a time, sound of music playing starts cutting out a bit, and everything slows down dramatically. If I wait long enough, I get this error:

Out of Virtual memory, oh no...
Requested: 8396800 bytes
Total Usage: 45359235072 bytes
C:\Users\krixa\Odin\src\common_memory.cpp(150): Assertion Failure: `pmblock != nullptr` Out of Virtual Memory, oh no...
bmaxa commented 1 year ago

Large static arrays, produce huge executables, I always allocate dynamicaly. You will always have problems with that, as they have to bi initialized in any language compiler, even assembler.

gingerBill commented 1 year ago

What is the code that produces this?

ghost commented 1 year ago

@gingerBill The problem seems to just be that I have a very large array literal using a slice type (citiesList := []City { // info here }). I had already posted this github issue before remembering that I had this. Anyways, I would probably expect the compiler to just error out on array literals that are too big to compile instead of freezing the system. Although, the previous version of Odin was actually able to compile the program. It's not a huge issue as I intended to replace this large array with something else anyways (parsing from the file and appending to an array is way too slow with the amount of information the program needs, so it will have to be something else other than that).

@bmaxa Thanks. Yeah, I am actually aware of the issues with large static arrays, but sometimes I just want to get things done quickly, especially when testing or prototyping something.

Kelimion commented 1 year ago

You could use #load to embed it and then @(init) to initialize that cities list on startup.