Most of the solutions here deal with the symptoms, but not the cause.
This link 519 explains the cause (a memory leak when storing to much data from a dataloader) and how to solve it.
I copy the code from the aforementioned link:
pred_list = []
target_list = []
# long version
for inputs, targets in DataLoader(dataset, num_workers=6, batch_size=64):
    pred_list.append(model.predict_on_batch(inputs))  # make model prediction
    targets_copy = deepcopy(targets)
    target_list.append(targets_copy)
    del inputs
    del targets