Skip to content

Commit b181f4a

Browse files
committed
Restored quick allocation code for windows and unix (@marcsous)
1 parent 0689743 commit b181f4a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

MappedTensor.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,9 +1380,14 @@ function make_complex(mtVar)
13801380
% - Get the name of a temporary file
13811381
strFilename = tempname;
13821382

1383-
% - Fast allocation on some platforms
1384-
bFailed = true;
1385-
% [bFailed, ~] = system(sprintf('fallocate -l %i %s', nNumEntries, strFilename));
1383+
% - Attempt fast allocation on some platforms
1384+
if (ispc)
1385+
[bFailed, ~] = system(sprintf('fsutil file createnew %s %i', strFilename, nNumEntries));
1386+
elseif (ismac || isunix)
1387+
[bFailed, ~] = system(sprintf('fallocate -l %i %s', nNumEntries, strFilename));
1388+
else
1389+
bFailed = true;
1390+
end
13861391

13871392
% - Slow fallback -- use Matlab to write zero data directly
13881393
if (bFailed)

0 commit comments

Comments
 (0)