Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler allocation failed #4593

Closed
markfirmware opened this issue Mar 1, 2020 · 4 comments
Closed

compiler allocation failed #4593

markfirmware opened this issue Mar 1, 2020 · 4 comments
Milestone

Comments

@markfirmware
Copy link
Contributor

markfirmware commented Mar 1, 2020

pub fn main() void {
    line_buffer[0] = 0;
}

var line_buffer: [10 * 1024 * 1024]u8 = undefined;

$
zig build-exe main.zig
allocation failed
Unable to dump stack trace: debug info stripped

@daurnimator
Copy link
Contributor

Works on my computer; with no zig-cache:

 $ /usr/bin/time -v  zig build-exe 4593.zig 
	Command being timed: "zig build-exe 4593.zig"
	User time (seconds): 0.91
	System time (seconds): 0.27
	Percent of CPU this job got: 98%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:01.21
	Average shared text size (kbytes): 0
	Average unshared data size (kbytes): 0
	Average stack size (kbytes): 0
	Average total size (kbytes): 0
	Maximum resident set size (kbytes): 1085480
	Average resident set size (kbytes): 0
	Major (requiring I/O) page faults: 1
	Minor (reclaiming a frame) page faults: 261252
	Voluntary context switches: 95
	Involuntary context switches: 13
	Swaps: 0
	File system inputs: 0
	File system outputs: 3040
	Socket messages sent: 0
	Socket messages received: 0
	Signals delivered: 0
	Page size (bytes): 4096
	Exit status: 0

@markfirmware
Copy link
Contributor Author

I get this on debian 10 x64 with 1GB mem 0.5GB swap:

allocation failed
Unable to dump stack trace: debug info stripped
Command terminated by signal 6
    Command being timed: "zig build-exe main.zig"
    User time (seconds): 0.35
    System time (seconds): 0.08
    Percent of CPU this job got: 99%
    Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.44
    Average shared text size (kbytes): 0
    Average unshared data size (kbytes): 0
    Average stack size (kbytes): 0
    Average total size (kbytes): 0
    Maximum resident set size (kbytes): 175620
    Average resident set size (kbytes): 0
    Major (requiring I/O) page faults: 0
    Minor (reclaiming a frame) page faults: 40091
    Voluntary context switches: 2
    Involuntary context switches: 79
    Swaps: 0
    File system inputs: 0
    File system outputs: 8
    Socket messages sent: 0
    Socket messages received: 0
    Signals delivered: 0
    Page size (bytes): 4096
    Exit status: 0

@frmdstryr
Copy link
Contributor

I created a heroku buildpack for zig to tried and deploy a stupid simple zig streamserver app and it also fails build on a server with 1GB of memory without any extra swap space.

-----> Building zig project
remote: allocation failed
remote: Unable to dump stack trace: debug info stripped
remote: 

After adding 1GB of swap space it worked.

From watching with top it seems zig requires about minimum of 1.2GB of free memory to build a very simple project.

@andrewrk
Copy link
Member

Duplicate of #471. The main effort to address this is working towards the self-hosted compiler + #6378.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants