-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Description
I’m observing what looks like a potential memory retention/leak pattern on iOS when a screen with RiveView is repeatedly mounted and unmounted. Also it's better to doublecheck on Android as well.
I cannot yet provide a full retain-chain proof, but profiling consistently shows that persistent Rive-related instances increase after repeated navigation cycles and do not return close to baseline.
Environment
@rive-app/react-native:0.2.3- iOS Simulator (Apple Silicon)
- React Native app with navigation (screen open/close flow)
Reproduction steps
- Render a screen that contains
RiveView(file loaded viauseRiveFile). - Navigate to that screen and back.
- Repeat 20-50 times.
- Profile with Instruments -> Allocations and compare generations.
Observed behavior
Across repeated cycles, persistent instance counts for Rive-related classes increase, including:
RiveReactNativeViewHybridRiveViewHybridRiveFileRiveRuntime.RiveView
This appears to indicate that some objects are retained longer than expected after unmount.
Expected behavior
After screen unmount (and short idle/GC period), Rive-related instances should be released and persistent counts should not keep increasing across cycles.
Minimal example
import { View, StyleSheet } from 'react-native';
import { RiveView, useRiveFile } from '@rive-app/react-native';
const FILE_INPUT = require('../assets/animation.riv');
export function RiveLeakTestScreen() {
const { riveFile, isLoading, error } = useRiveFile(FILE_INPUT);
if (!riveFile || isLoading || error) return null;
return (
<View style={styles.container}>
<RiveView file={riveFile} style={styles.rive} autoPlay />
</View>
);
}
const styles = StyleSheet.create({
container: { flex: 1 },
rive: { width: '100%', height: '100%' },
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels