This repository contains a test application that demonstrates a memory usage issue with the npm package mmap-object, as reported in this GitHub issue.
The loadMasterFile()
function in index.js
loads a large text file into memory using mmap-object
and logs the memory usage details. The text file is assumed to be ASCII encoded, and as such, it should take only one byte for each character.
The mmap-object
library is taking up more memory than expected. For larger files, the library can take up to three or four times more memory than the original file size.
- Clone this repository:
git clone https://github.com/monteiz/mmap-object-memory-issue.git
- Enter the directory:
cd mmap-object-memory-issue
- Install dependencies with
npm install
- Run the application with
npm run start
- Check the memory usage details logged in the console
The loadMasterFile()
function should load the text file into memory using mmap-object
, and log the memory usage details. The memory usage should be proportional to the size of the file (in bytes).
The mmap-object
library is taking up more memory than expected. For larger files, the library can take up to three or four times more memory than the original file size.
This application requires the following dependencies:
- fs
- readline
- mmap-object
- buffer
This code is released under the MIT license.