This brief discusses data-driven design techniques for batch-to-batch optimization problems and proposes a new input-mapping-based online uncertainty compensation method for optimization-based iterative learning control (ILC) with limited memory. Since process uncertainties are generally inevitable, we collect historical data that incorporates past inputs and outputs to provide more insight into plant uncertain dynamics, resulting in a more accurate optimization model for optimal ILC solution. Instead of learning from a single step, our proposed method maintains a memory of the latest executed steps and updates the ILC solution using a linear combination of the memory and quadratic programming. A rigorous theoretical analysis shows that such a design provides robust benefits as well as asymptotic and monotonic stability properties under mild conditions. Finally, we demonstrate our design through an illustrative numerical example.