Ok.
Just be careful though that you are playing at the limit of the memory fragmentation and so any small change in your code can make you OOM for seemingly unrelated reasons.
It would be more reliable to reduce batch size or something similar to make sure you are below the max memory by a safe margin.