• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3require('../common');
4
5// Test that huge objects don't crash due to exceeding the maximum heap size.
6
7const util = require('util');
8
9// Create a difficult to stringify object. Without the artificial limitation
10// this would crash or throw an maximum string size error.
11let last = {};
12const obj = last;
13
14for (let i = 0; i < 1000; i++) {
15  last.next = { circular: obj, last, obj: { a: 1, b: 2, c: true } };
16  last = last.next;
17  obj[i] = last;
18}
19
20util.inspect(obj, { depth: Infinity });
21