Skip to content

compiler allocation failed #4593

Closed
Closed

Description

@markfirmware
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

Activity

  1. daurnimator commented on Mar 1, 2020

    @daurnimator
    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
    
  2. markfirmware commented on Mar 1, 2020

    @markfirmware
    ContributorAuthor

    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
    
  3. added this to the 0.7.0 milestone on Mar 2, 2020
  4. frmdstryr commented on Apr 1, 2020

    @frmdstryr
    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.

  5. andrewrk commented on Oct 17, 2020

    @andrewrk
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions