Skip to content

out of memory #568

@lastmjs

Description

@lastmjs

First off, my JavaScript environment is very custom and different than the web or Node.js. We are running in a wasm32-wasi environment with QuickJS, using wasmedge-quickjs, and Wasmtime on the Internet Computer.

That being said, the strange thing is that I had this working about a week ago, but now it doesn't work. We've been doing a lot of low-level changes to our JS environment (we're working at the engine/platform level), but I just don't understand what could have caused this.

The simple problem is that we get an error just trying to initialize the database: out of memory

Here's our code:

import { Server } from 'azle';
import express from 'express';
import initSqlJs from 'sql.js/dist/sql-asm.js';

export default Server(async () => {
    const SQL = await initSqlJs({
        locateFile: (filename) => `/dist/${filename}`
    });

    const db = new SQL.Database();

    const app = express();

    app.get('/', (req, res) => {
        res.send('Hello world');
    });

    return app.listen();
});

We have to use asm as our environment does not have a Wasm interpreter. I've tried sql-asm-memory-growth.js as well and I get the same error. I've even gone back multiple versions to maybe 1.7.0 and the error is always there.

Any ideas on what could cause this? I've also tried adding:

            TOTAL_STACK: 4_000_000_000,
            TOTAL_MEMORY: 4_000_000_000,
            FAST_MEMORY: 4_000_000_000

to the initSqlJs options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions