How To Fix Chia ‘RunTime Error: Bad Allocation’ On Windows


Have you started mining Chia recently and keep getting the pesky bad allocation errors? Well fret not, there is usually a very simple reason why they pop up and we will walk you through all of them.

First, the basics. Each chia plot requires atleast 3390 MiB of RAM and 2 threads each. Notice this is GiB and NOT GB. 3390 GiB translates to 3639 GB of RAM. It also needs 2 threads for every plot and the k=32 plot size (which is the most popular) requires 239 GiB of temporary space (or 257 GB) to plot.

Beware! Several Used NVIDIA GeForce RTX 30 Graphics Cards With Defective Memory Modules Being Sold After Being Abused In Crypto Mining

Now lets assume you have a computer with 8 cores/16 threads, 32 GB of RAM and a 2 TB NVME. Theoratically, you should be able to mine 8 plots at a time right? So why are you getting all these bad allocation errors?

How to fix Chia bad allocation errors on Windows

  1. The most common mistake is that users enter their total RAM size in the chia client. That space isn't asking fo the total amount of ram assigned for the parallel plots. It is PER plot. So if you are planning to write 7 plots together, the amount of RAM you enter will remain 3390 (because it is per plot) and not 23,730 (3390x7). The same goes for threads. Threads will remain 2.
  2. Secondly, the client uses GiB and your RAM is measured in GB. These are similar sounding but completely different metrics. If you enter 8 GiB, you will get a bad allocation error. 8 GB of RAM is actually 8.58 GiB of RAM. So make sure you are using the proper units in the client.
  3. Secondly, you cannot use all of the RAM at your disposal as you have to leave something for the OS to use or it will get sluggish. We recommend the following technique. Each plot requires 3390 MiB to plot so for every plot you are thinking of processing in parallel simply multiply it by that number (but not for all cores - more on this below). We like to round it off to a clean 3400 MiB. If you are planning to plot 7 plots in parallel (that is the maximum you should do on an 8 core), and you have 32 GB of RAM available, you can punch in 3400 in the Chia client.
  4. Thirdly, you cannot use all of the cores at your disposal. You have to leave atleast one core/two threads for MS Windows. So if you have an 8 core/16 thread CPU, you can only use 14 threads out of these to process 7 chia plots at most. Your thread value will remain 2 but don't do more than 7 in parallel.
  5. But what if you have done all of the above and it is still throwing you an error? Well then it most likely has to do with the windows page file. Type performance in start menu and click on adjust windows performance and appearance. Now click on advanced and click on "Change" under virtual memory. Change this pagefile for C form windows managed to a number that is proportional to your plots. On our 32 GB example, we set the page file minimum to 10 GB and maximum to 30 GB for drive C (where the Chia client was located) and also put a 1 GB to 10 GB page file for our plotting drive.
  6. Still getting an error? Launch parallel plots in a staggered fashion! Sometimes queuing the maximum capability of your PC at once (7 in this case) can result in the OS stutteriing and handing out several bad allocations. To fix this, launch 70-80% of the capacity in parallel (6 plots) and then another one once all the other plots have started phase 2 (click on view log) and you are sure they arent giving the bad allocation error.

Hopefully these tips will have fixed the issue for you and you can put your NVMEs to work farming that sweet Chia reward!