Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

singleton class memory leakage

I set up a singleton following the instructions at this tutorial, but when I analyze it I see the following memory leaks:

enter image description here

How do I rectify this memory leakage in my singleton class?

like image 637
Srinivas Avatar asked Apr 15 '26 10:04

Srinivas


1 Answers

I think that whoever that wrote that tutorial didn't write this right:

 [[self alloc] init];

Instead, it sould be:

_sharedMySingleton = [[MySingleton alloc]init];

I hope it helps

like image 180
Fran Sevillano Avatar answered Apr 18 '26 02:04

Fran Sevillano