ibireme / YYText

Powerful text framework for iOS to display and edit rich text.
MIT License
8.84k stars 1.67k forks source link

yy_attachmentStringWithContent内存泄露 #994

Open a130785 opened 6 months ago

a130785 commented 6 months ago

UIImageView *image = [UIImageView new]; attachment = [NSMutableAttributedString yy_attachmentStringWithContent:image contentMode:UIViewContentModeCenter attachmentSize:image.size alignToFont:font alignment:YYTextVerticalAlignmentCenter]; [text appendAttributedString: attachment];

yy_attachmentStringWithContent当我为Content设置一个image view时,会报内存泄露。

IMG_5966

为什么要设置UIImageView而不是image,因为我需要先显示占位图在富文本中,然后异步加载图片,加载成功后再更新UIImageView的image。

但是这个内存泄露不知道要怎么解决,weak UIImageView和页面消失的时候移除UIImageView都没有用。

eliswee commented 5 months ago

你这个内存泄露用什么检测的?

a130785 commented 4 months ago

FBRetainCycleDetector 和 MLeaksFinder

eliswee commented 4 months ago

明白~感谢~

LxwYl commented 3 months ago

你好,如果不知道image的大小,想做异步的话,怎么更新 attachmentSize