Although the linear method is one of the most robust algorithms for optimizing non-linearly parametrized wavefunctions in variational Monte Carlo, it suffers from a memory bottleneck due to the fact at each optimization step a generalized eigenvalue problem is solved in which the Hamiltonian and overlap matrices are stored in memory. Here we demonstrate that by applying the Jacobi-Davidson algorithm, one can solve the generalized eigenvalue problem iteratively without having to build and store the matrices in question. The resulting direct linear method greatly lowers the cost and improves the scaling of the algorithm with respect to the number of parameters. To further improve the efficiency of optimization for wavefunctions with a large number of parameters, we use the first order method AMSGrad far from the minimum as it is very inexpensive, and only switch to the direct linear method near the end of the optimization where methods such as AMSGrad have long convergence tails. We apply this improved optimizer to various wavefunctions with both real and orbital space Jastrow factors for atomic systems such as Beryllium and Neon, molecular systems such as the Carbon dimer and Iron(II) Porphyrin, and model systems such as the Hubbard model and Hydrogen chains.I.