• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/99_bugs/57_resource_uvcount0_retain_leak

  1 Test that uvcount=0 resources are correctly freed when reached via a
  2 GC sweep. The script builds a self-referential cycle holding a pipe
  3 (whose io.handle resources are uvcount=0) and forces a collection;
  4 under the bug the io.handle structs are leaked on every `gc()` call.
  5 
  6 This test depends on running under a leak detector.
  7 
  8 -- Testcase --
  9 {%
 10         import * as io from 'io';
 11         import { stdout } from 'fs';
 12 
 13         for (let i = 0; i < 3; i++) {
 14                 let cycle = [];
 15                 cycle[0] = cycle;
 16                 cycle[1] = io.pipe();
 17                 cycle = null;
 18                 gc("collect");
 19         }
 20 
 21         print("ok\n");
 22         stdout.flush();
 23 %}
 24 -- End --
 25 
 26 -- Expect stdout --
 27 ok
 28 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt