RenderInContext - creating memory that was not quickly released

When debugging tools using "ObjectAlloc", I notice that 7 megabytes of memory is allocated to call renderInContext, but it is never released. When I comment on the call to renderInContext, this does not happen, and future calls to renderInContext do not continue to increase the allocation of memory.

UIGraphicsBeginImageContext(contentHolder.bounds.size);
[contentHolder.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Is there any way to make this memory free?

+3
source share
1 answer

I learned how to free renderInContext memory. Just run the method that calls renderInContext in the main thread, and it will automatically free the allocated memory.

+1
source

Source: https://habr.com/ru/post/1744424/


All Articles