memory leak problems with tetris poop

This commit is contained in:
Peter Harpending
2025-10-26 19:51:57 -07:00
parent 4bd279798c
commit 882a416831
19 changed files with 397 additions and 80 deletions
+6 -8
View File
@@ -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.