Skip to content

Why is this package eating all my memory? #52

@wkd-kapsule

Description

@wkd-kapsule

Hi! I stumbled on your package thinking I found exactly what I needed: a monaco-editor wrapper that would let me use TextMate to customize the theme. I've been building my own tsx tokenizer for 2 days, deep in the Regex hell.

But now that I try your package, even the most minimal implementation will eat up all my memory and the server will never resolve. My project is of a decent size but without your packages, Node.js takes around 2 GB of memory. With them, Node.js goes up to 10 GB before I kill it, unless I want my pc to crash... Might it be related to me using Next.js as a framework?

Any help would be greatly appreciated!

export const CodeEditor = () => {
  // {...} some files management here

  const [isReady, setIsReady] = useState(false)
  
  useEffect(() => {
    initialize.then(() => setIsReady(true))
  }, [])
  
  return (
    isReady && (
      <Edit
        programmingLanguage={currentFile.lang}
        fileUri={currentFile.path}
        height={'75vh'}
        onChange={code => (currentFile.code = code)}
        options={{
          cursorWidth: 2,
          fontFamily: 'Fira Code',
          fontLigatures: true,
          fontWeight: '400',
          fontSize: 12,
          letterSpacing: 0.5,
          lineHeight: 1.6,
          wrappingIndent: 'same',
          tabSize: 2,
          detectIndentation: false,
          readOnly: currentFile.readonly,
          minimap: {enabled: false},
          scrollBeyondLastColumn: 0,
          wordBreak: 'keepAll',
          wordWrap: 'on'
        }}
      />
    )
  )
}

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