Since the exception is thrown in __init__ your loader was actually never instantiated.
This would probably be the reason, why you can’t delete loader in the except block.
Is the memory still in use after the exception?
If so, could you try to create the try block inside of __init__ and empty the cache once you get the OOM error?
Are you getting the OOM error for DataLoader2 from the beginning or just after DataLoader1 could not be created?