The variance can be expressed as proportional to the squared difference between every value and the mean value, or (as many threads here in stats.SE documented, like this answer I wrote to another question) it can alternatively be expressed as proportional to the squared pairwise difference between every sample.
So we know:
$$\text {Var}(x) = \frac{1}{n} \cdot \sum_{i}(X_i-\overline{X})^2 =
\frac{1}{2n^2} \cdot \sum_{i,j}(X_i-X_j)^2$$
Let's say you add another sample, indexed as the last index, $k$. Your previous variance would be:
$$\text {Var}_{old}(x) = \frac{1}{2(n-1)^2} \cdot \sum_{i<k,j<k}(X_i-X_j)^2$$
Your new variance is
$$\text {Var}_{new}(x) = \frac{1}{2n^2} \cdot \sum_{i,j}(X_i-X_j)^2 =
\frac{1}{2n^2} \cdot
\left(
\sum_{i<k,j<k}(X_i-X_j)^2 + \sum_{j<k}(X_k-X_j)^2 + \sum_{i<k}(X_i-X_k)^2
\right)$$
But
$$\sum_{j<k}(X_k-X_j)^2 = \sum_{i<k}(X_i-X_k)^2\\
\sum_{i<k,j<k}(X_i-X_j)^2 = {2(n-1)^2} \cdot \text {Var}_{old}(x)
$$
So
$$\text {Var}_{new}(x) = \left(\frac{n-1}{n}\right)^2
\text{Var}_{old}(x)+
\frac{1}{n^2}
\sum_{j<k}(X_k-X_j)^2
$$
As @MarkL.Stone said in the comments, this still isn't efficient because we must keep every $X_i$. So, let's expand the formula to arrive at something more tractable.
$$\frac{1}{n^2}\sum_{j<k}(X_k-X_j)^2=\\
\frac{1}{n^2}\sum_{j<k}(X_k^2 - 2 \cdot X_j \cdot X_k + X_j^2)=\\
\frac{1}{n^2}\left(\sum_{j<k}X_k^2 - 2 \cdot X_k \cdot \sum_{j<k} X_j + \sum_{j<k} X_j^2\right)=\\
\frac{1}{n^2}\left(k\cdot X_k^2 - 2 \cdot X_k \cdot (k-1) \cdot \overline{X_{old}} + (k-1) \cdot \overline{X^2_{old}}\right)\\
$$
Because
$$\sum_{j<k} X_j = (k-1) \cdot \overline{X_{old}}\\
\sum_{j<k} X_j^2 = (k-1) \cdot \overline{X^2_{old}}$$
The final form is then
$$\text {Var}_{new}(x) = \left(\frac{n-1}{n}\right)^2
\text{Var}_{old}(x)+
\frac{1}{n^2}\left(k\cdot X_k^2 - 2 \cdot X_k \cdot (k-1) \cdot \overline{X_{old}} + (k-1) \cdot \overline{X^2_{old}}\right)
$$
You can use this formula to update the variance effectively memory-wise. You can also complement it to use batches instead of single point updates.
Basically you need to store the average, the average of the squared samples, and the variance every iteration, and use it to update the variance formula.
Further
$$\overline{X^2_{old}} = \text{Var}_{old}(x) + (\overline{X_{old}})^2\\
\therefore\text {Var}_{new}(x) = \left(\frac{n-1}{n}\right)^2
\text{Var}_{old}(x)+
\frac{1}{n^2}\left(k\cdot X_k^2 - 2 \cdot X_k \cdot (k-1) \cdot \overline{X_{old}} + (k-1) \cdot \left(\text{Var}_{old}(x) + (\overline{X_{old}})^2\right)\right)
$$
Which brings the number of quantities that need to be stored down to 2.