<commit_before>//
// Main app file. Loads the .env file, runs setup code, and starts the server.
// This code should be kept to a minimum. Any setup code that gets large should
// be abstracted into modules under /lib.
//

var express = require('express'),
    setup = require('./lib/setup'),
    heapdump = require('heapdump'),
    memwatch = require('memwatch-next');

var app = module.exports = express();
setup(app);

// Start the server and send a message to IPC for the integration test
// helper to hook into.
app.listen(process.env.PORT, function() {
  console.log('Listening on port ' + process.env.PORT);
  if(process.send) process.send('listening');
});

// Write heapdumps
var i = 0;
var write = function() {
  i++;
  heapdump.writeSnapshot(__dirname + "/public/heapdumps/" + i + ".heapsnapshot");
}
setInterval(write, 1000 * 60);
write();

// Logs memory usage
var log = function() {
  console.log('memory ', process.memoryUsage());<commit_msg>latest<commit_after>//
// Main app file. Loads the .env file, runs setup code, and starts the server.
// This code should be kept to a minimum. Any setup code that gets large should
// be abstracted into modules under /lib.
//

var express = require('express'),
    setup = require('./lib/setup'),
    heapdump = require('heapdump'),
    memwatch = require('memwatch-next');

var app = module.exports = express();
setup(app);

// Start the server and send a message to IPC for the integration test
// helper to hook into.
app.listen(process.env.PORT, function() {
  console.log('Listening on port ' + process.env.PORT);
  if(process.send) process.send('listening');
});

// Write heapdumps
var i = 0;
var write = function() {
  i++;
  heapdump.writeSnapshot(__dirname + "/public/heapdumps/" + i + ".heapsnapshot");
}
setInterval(write, 1000 * 60);
write();

// Logs memory usage
var log = function() {
  memwatch.gc();
  console.log('memory ', process.memoryUsage());
{'fraction_non_alphanumeric': 0.15072765072765074, 'fraction_numerical': 0.007276507276507277, 'mean_word_length': 3.753086419753086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5051344', 'n_tokens_mistral': 590, 'n_tokens_neox': 575, 'n_words': 200}