Bug 180593

Summary: Web Inspector: Canvas recordings use a lot of memory and are never released
Product: WebKit Reporter: BJ Burg <bburg>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bburg, hi, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 173807    

Description BJ Burg 2017-12-08 11:37:52 PST
via Nelson Thachuk:

* SUMMARY
- Canvas Tab: high resource usage when recording/after completing recording

* STEPS TO REPRODUCE
1. Launch Safari
2. Navigate to https://www.google.com/maps/place/Apple+Infinite+Loop/@37.3316756,-122.0323777,17z/data=!3m1!4b1!4m5!3m4!1s0x808fb5b6c4951d0f:0xb651414deb31e9fb!8m2!3d37.3316756!4d-122.030189
3. Show Web Inspector (⌥⌘I)
4. Click New Tab button
5. Select Canvas tab
6. Launch Activity Monitor
7. Filter by “Safari”
8. Return to Safari and record the Canvas
9. Interact with Google Maps (NOTE: the Web Content processes’ CPU usage spikes)
10. Wait for recording to finish (NOTE: the Web Content processes’ CPU usage returns to normal and Web Inspector’s processes’ Memory usage spikes)
11. Dismiss the recording or close the Canvas tab and wait 30 seconds

* EXPECTED RESULTS
- Memory should be released

* ACTUAL RESULTS
- Memory is not released until the Web Inspector process is killed
Comment 1 BJ Burg 2017-12-08 11:39:14 PST
<rdar://problem/35893620>
Comment 2 BJ Burg 2017-12-08 11:41:34 PST
The resource usage is somewhat expected, though we should have some way to clear recordings from memory if we don't expect to ever see them again. I don't know in what cases this would make sense.

After navigating, clear if:
- User never opened the recording
- Canvas Tab is closed
- Web Inspector is closed

Preserve recording if:
- User has opened it at least once
- It is imported from file
- Relevant canvas has been deleted from DOM but page hasn't navigated