Before trying out opencode, I had been experimenting which chunkhound, that indexes your source folder to allow searching later. It stores its database file(s) in the .chunkhound folder, and in my project that folder was around 27GB in size.
It seems like opencode was trying to load the files in that folder, because when I ran opencode the memory usage would shoot up, and opencode was using 29GB of RAM, and my computer was getting very slow.
Deleting that folder solved the problem. Unfortunately I didn't check what the sizes and filetypes of files in that folder were before I deleted it.