[erlang-questions] File size limits on file:write_file and file:write?
Tony Rogvall
tony@REDACTED
Wed May 4 14:33:25 CEST 2011
On 4 maj 2011, at 13.49, Dave Challis wrote:
> On 04/05/11 12:45, Ahmed Omar wrote:
>> You wanted file:write_file/2 i guess
>
> Oops, that was a mistake in the original post.
>
> I've tried both:
>
> file:write_file("/tmp/foo", Data).
>
Nearly the same thing as below.
> and
>
> {ok, Fp} = file:open("/tmp/foo", [write]).
> file:write(Fp, Data).
>
> Both give {error,badarg} when Data > 2Gb, and write the file fine otherwise.
>
Looks like the problem is in beam/utils/io_list_len.
io_list_len returns an int, which is 32 bit on x64_64.
The return type should probably be Sint, but the all calls to io_list_len must
be updated accordingly.
Workaround: write in smaller chunks.
/Tony
"Have run Make so many times I dunno what's installed anymore"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110504/1903cc80/attachment.htm>
More information about the erlang-questions
mailing list