[erlang-questions] File size limits on file:write_file and file:write?

Dave Challis <>
Wed May 4 12:29:32 CEST 2011

I'm having trouble writing large binaries to disk using file:write or 

I couldn't see any limits mentioned in the file module documentation 
(http://www.erlang.org/doc/man/file.html), or on the erlang limits page 
(http://www.erlang.org/doc/efficiency_guide/advanced.html#id67006) though.

I'm trying to write a 3Gb binary to disk using:

Data = <<...some 3Gb binary...>>.
file:write("/tmp/foo", Data).

I get the error:

I've checked that data is the right type:
is_binary(Data) -> true
byte_size(Data) -> 3200000000

If I shrink Data to less than 2Gb, the write operation works fine.

Erlang is running in 64-bit mode, my erlang system info is:
Erlang R14B02 (erts-5.8.3) [source] [64-bit] [smp:8:8] [rq:8] 
[async-threads:0] [hipe] [kernel-poll:false]

Is there something I should be doing differently, or a compile time 
option that I missed?

Dave Challis

More information about the erlang-questions mailing list