Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.3.2
-
None
-
Linux pc 3.16.2-1-ARCH #1 SMP PREEMPT Sat Sep 6 13:12:51 CEST 2014 x86_64 GNU/Linux
Description
I attached a trivial testcase to reproduce the leak.
Short version here:
var queue = []; for (var i = 0; i < 1000; i++) { queue.unshift(5); queue.splice(0, 1); }
This code creates an array, and then adds an element to it and cuts out an array of length 1 starting from the element number 0. The last two steps are repeated 1000 times.
V4 utilizes all available memory and crashes.
300 iterations produce ~200 MiB memory usage for me.
350 iterations — ~1.5 GiB.
360 iterations — ~3.1 GiB.
Update:
Actually, unshift-pop produces the same behavior (memleak), unshift-shift does not.
unshift-pop — bad
unshift-splice — bad
unshift-shift — ok
push-pop — ok
push-splice — ok
push-shift — ok
So, the memleak could be reproduced even with
var queue = []; for (var i = 0; i < 1000; i++) { queue.unshift(5); queue.pop(); }
Attachments
Issue Links
- is required for
-
QTBUG-41613 Issues to be fixed before 5.4.0 RC
- Closed