Open jejikeh opened 7 months ago
Here are the test files.
go program:
// main.go
package main
import(
"fmt"
)
func main() {
for {
fmt.Println("Hello, focus")
}
}
build script for go:
# run-go.sh
go run main.go
c program:
// main.c
#include <stdio.h>
int main(void) {
for (;;) {
printf("Hello, focus\n");
}
}
build script for c:
# run-c.sh
clang main.c
My project config for build commands
[[build commands]]
clear_build_output_before_running: true
[run c]
build_command: ./run-c.sh
open_panel_on_build: true
build_working_dir: /Users/jejikeh/Code/focus/bug-stdout
run_command: ./a.out
run_working_dir: /Users/jejikeh/Code/focus/bug-stdout
timeout_in_seconds: 5
[run go]
build_command: ./run-go.sh
open_panel_on_build: true
build_working_dir: /Users/jejikeh/Code/focus/bug-stdout
On Linux (Fedora 38 + GNOME), the memory usage spike still persists, but the editor stays responsive, and the timeout options work just fine.
Memory Leak when launch build command with excessive stdout calls
This video provides a demonstration of the issue.
In the C version of the test, the editor does not crash, but RAM usage increases dramatically from 300MB to 5GB within seconds. Additionally, I attempted to rerun the build command with the
clear_build_output_before_running
option enabled, but this did not resolve the issue.Go version of the program crashes Focus entirely.
Additionally,
timeout_in_seconds
doesn't help if it's set to more than 1 second. (I believe this may depend on the hardware.) VideoExpected behavior
In the C example, it would be acceptable if, at the very least, after terminating the build command, the RAM usage drops back to its initial level.
Regarding the Go example, I'm uncertain. If Go prints to the console at a slower rate compared to C, why does it cause the Focus to crash completely?
OS: OSX Sonoma 14.4.1 (MacBook Air M1)
Focus Version: 0.3.4