bash:由于查找结果循环而导致记忆不足

发布于 2025-01-21 05:41:45 字数 483 浏览 1 评论 0原文

我的bash脚本在以下点返回xrealloc:不能分配1844444444071562067968字节

for file in $(find "$BUFFER/tmpFilesArchives" -type f) 
do
    extract_VMs
done

folder $ $ buffer/tmpfilesarchives包含大约。 50.000文件。该机器的内存约为128GB。

是否有更好的(即保存内存)方法可以通过查找结果进行循环?

我正在尝试以下一个,但也破裂了。

while IFS= read -r -d '' file; do
    extract_VMs
done < <(find "$BUFFER/tmpFilesArchives" -type f)

提前致谢。

My bash script fails at the below point returning xrealloc: cannot allocate 18446744071562067968 bytes:

for file in $(find "$BUFFER/tmpFilesArchives" -type f) 
do
    extract_VMs
done

The folder $BUFFER/tmpFilesArchives contains approx. 50.000 files.The machine has around 128GB of memory.

Is there a better (i.e. memory-saving) approach to loop through the results of find?

I was trying the below one but it also breaks.

while IFS= read -r -d '' file; do
    extract_VMs
done < <(find "$BUFFER/tmpFilesArchives" -type f)

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文