vscode-codeql icon indicating copy to clipboard operation
vscode-codeql copied to clipboard

Query evaluation ran out of memory (Java heap maximum: 1165 MiB, Off-heap arrays maximum: 1941 MiB).

Open raj-kumar-j opened this issue 4 years ago • 1 comments

Hi Team, I'm using vscode-codeql version 1.4.8 and I got this error Query evaluation ran out of memory (Java heap maximum: 1165 MiB, Off-heap arrays maximum: 1941 MiB). while running a query to find UAF vulnerability in C source code. The db size is 4+ gb. The query execution stopped after this error. Below is the query I executed.

import cpp
import semmle.code.cpp.dataflow.DataFlow
import DataFlow::PathGraph

class Config extends DataFlow::Configuration{
    Config() {this = "Use after free"}

    override predicate isSource(DataFlow::Node arg) {
        exists(FunctionCall call |
            call.getArgument(0) = arg.asDefiningArgument() /* for pointers use asDefiningArgument */  and
            call.getTarget().hasGlobalOrStdName("free")
        )
    }
    
    override predicate isSink(DataFlow::Node sink) {
        dereferenced(sink.asExpr())
    }
}

from DataFlow::PathNode source, DataFlow::PathNode sink, Config config
where config.hasFlowPath(source, sink)
select sink, source, sink, "Potential Use After Free"

I was searching ways to increase heap size but I do not have java installed on my windows 10.

raj-kumar-j avatar May 17 '21 09:05 raj-kumar-j

Hello! It looks like you need to increase the memory setting to run this query on this database, which seems to be using about 3GB by default. You can configure the memory used by CodeQL in VS Code by going to Preferences: Open Settings (UI), and setting the value of CodeQL > Running Queries: Memory. See https://codeql.github.com/docs/codeql-for-visual-studio-code/customizing-settings/#configuring-settings-for-running-queries for more information.

adityasharad avatar May 17 '21 15:05 adityasharad