fixed memory leak cause by singleton.
Merge pull request #7347 from Dhilan007/v3-memory-leak

fixed memory leak cause by singleton.