Fix Tensorflow Allocation Memory: Allocation exceeds 10% of system memory Error

By | April 18, 2020

If you are using tensorflow to train a deep learning model, you may encouter this allocation memory error: Allocation exceeds 10% of system memory. In this tutorial, we will introduce some methods to fix it.

fix tensorflow Allocation exceeds 10% of system memory Error

Why does this error occur?

This error occurs because of the lack of memory. TensorFlow needs more memory to save variables.

How to fix this error?

There are two main methods to fix this error.

1.Enlarge the memmory of your computer, such as 32G.

2.Analysis your model, check what tensorflow variables or numpy variables have used more memories.

For example, many models may read all of train, test and validation data into the memory, however, they can only read a batch of sample data to train.