Raise IndexDefect when deleting element at out of bounds index (#17821)
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Heiko Nickerl <mail@hnicke.de> Co-authored-by: Heiko Nickerl <heiko.nickerl@flipapp.de>
This commit is contained in:
parent
eb0b323f45
commit
92cb765714
5 changed files with 70 additions and 36 deletions
|
|
@ -17,14 +17,10 @@ for i in 0..1024:
|
|||
s.add(obj)
|
||||
|
||||
proc limit*[t](a: var seq[t]) =
|
||||
var loop = s.len() - 512
|
||||
for i in 0..loop:
|
||||
#echo i
|
||||
#GC_fullCollect()
|
||||
while s.len > 0:
|
||||
if getOccupiedMem() > 3000_000: quit("still a leak!")
|
||||
s.delete(i)
|
||||
s.delete(0)
|
||||
|
||||
s.limit()
|
||||
|
||||
echo "no leak: ", getOccupiedMem()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue