aboutsummaryrefslogtreecommitdiff
path: root/src/library_memfs.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-08-27 14:17:38 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-08-27 14:17:38 -0700
commit3b2b7341aad1fb098b4a90a88ee8ee271b61e39a (patch)
tree77aa96f974c4bedd16d163fc8c9a96ae7ae43bfb /src/library_memfs.js
parent8c249ab4d5c786395ab6e7043e95a0a2387d4461 (diff)
copy the entire datafile in one chunk into the heap, avoiding one malloc per file, but at the cost of not being able to free them
Diffstat (limited to 'src/library_memfs.js')
-rw-r--r--src/library_memfs.js6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/library_memfs.js b/src/library_memfs.js
index 63326c42..354f5e95 100644
--- a/src/library_memfs.js
+++ b/src/library_memfs.js
@@ -2,17 +2,13 @@ mergeInto(LibraryManager.library, {
$MEMFS__deps: ['$FS'],
$MEMFS: {
// content modes
- CONTENT_OWNING: 1, // contains a subarray into the heap, and we own it - need to free() when no longer needed
+ CONTENT_OWNING: 1, // contains a subarray into the heap, and we own it, without copying (note: someone else needs to free() it, if that is necessary)
CONTENT_FLEXIBLE: 2, // has been modified or never set to anything, and is a flexible js array that can grow/shrink
CONTENT_FIXED: 3, // contains some fixed-size content written into it, in a typed array
ensureFlexible: function(node) {
if (node.contentMode !== MEMFS.CONTENT_FLEXIBLE) {
var contents = node.contents;
node.contents = Array.prototype.slice.call(contents);
- if (node.contentMode === MEMFS.CONTENT_OWNING) {
- assert(contents.byteOffset);
- Module['_free'](contents.byteOffset);
- }
node.contentMode = MEMFS.CONTENT_FLEXIBLE;
}
},