diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm index 8f60235ca3b6..1242964f6283 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm @@ -140,6 +140,12 @@ - (void)_setStateAndResubscribeImageResponseObserver:(const ImageShadowNode::Con observerCoordinator.removeObserver(_imageResponseObserverProxy); } + // Release the previous image to prevent memory accumulation + // when the source prop changes rapidly (e.g., in animations/slideshows). + // The UIImageView retains the UIImage, preventing deallocation until + // the next image arrives, which can cause significant memory growth. + _imageView.image = nil; + _state = state; if (_state) { @@ -301,4 +307,4 @@ - (void)didReceiveFailure:(NSError *)error fromObserver:(const void *)observer Class RCTImageCls(void) { return RCTImageComponentView.class; -} +} \ No newline at end of file