I have been creating a javascript application using a library converted
with Emscripten and was looking for good ways to reduce browser memory
usage. One of the possibilities I have tried to create a filesystem device
with buffer backend (to store file data) in order to avoid allocating a
gigantic Emscripten heap. However, since my converted library uses ftell I
ran into problems with the following code in Emscripten generated output
for the function ftell:
function _ftell(stream) {
// long ftell(FILE *stream);
// http://pubs.opengroup.org/onlinepubs/000095399/functions/ftell.html
stream = FS.getStreamFromPtr(stream);
if (!stream) {
___setErrNo(ERRNO_CODES.EBADF);
return -1;
}
* if (FS.isChrdev(stream.node.mode)) {*
* ___setErrNo(ERRNO_CODES.ESPIPE);*
* return -1;*
* } else {*
return stream.position;
* }*
}
These lines cause all ftell calls to my "device" to fail and thereby the
entire process stops with errors. (and removing these lines allows my
program to work correctly) This leaves me with three questions:
1. Is there a way to allow ftell for devices?
2. Is there perhaps a better way to override filesystem calls than using
devices in my use case?
3. Are there any recommended ways to store fairly large amounts of data for
Emscripten use without running out of browser memory? (and causing an
error) I investigated using IndexedDB for this purpose, but it doesn't
appear to work for me due to its asynchronous nature.
Thanks in advance,
David
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.