memory leak problems with tetris poop
This commit is contained in:
@@ -57,18 +57,11 @@ new2(BasePath) ->
|
||||
true -> filename:absname(BasePath);
|
||||
false -> filename:absname(filename:dirname(BasePath))
|
||||
end,
|
||||
%% hacky, fuck you
|
||||
RemovePrefix =
|
||||
fun (Prefix, Size, From) ->
|
||||
<<Prefix:Size/bytes, Rest/bytes>> = From,
|
||||
Rest
|
||||
end,
|
||||
BBaseDir = unicode:characters_to_binary(BaseDir),
|
||||
BBS = byte_size(BBaseDir),
|
||||
HandlePath =
|
||||
fun(AbsPath, AccCache) ->
|
||||
BAbsPath = unicode:characters_to_binary(AbsPath),
|
||||
HttpPath = RemovePrefix(BBaseDir, BBS, BAbsPath),
|
||||
HttpPath = remove_prefix(BBaseDir, BAbsPath),
|
||||
NewCache =
|
||||
case fd_sfc_entry:new(AbsPath) of
|
||||
{found, Entry} -> maps:put(HttpPath, Entry, AccCache);
|
||||
@@ -81,3 +74,8 @@ new2(BasePath) ->
|
||||
_recursive = true,
|
||||
_fun = HandlePath,
|
||||
_init_acc = #{}).
|
||||
|
||||
remove_prefix(Prefix, From) ->
|
||||
Size = byte_size(Prefix),
|
||||
<<Prefix:Size/bytes, Rest/bytes>> = From,
|
||||
Rest.
|
||||
|
||||
Reference in New Issue
Block a user