Java中查找数组是否可能存在内存问题?

发布于 2025-02-03 06:54:36 字数 169 浏览 4 评论 0 原文

我正在尝试Java和MongoDB,并且正在进行查找聚合。我注意到,当我执行查找时,返回的文档包含查找字段作为文档数组 - 作为 java.util.arraylist 。 因此,我的问题是 - 如果我有一个在查找阵列中我会加载许多文档的情况,该怎么办?这可能是我的Java Heap内存的问题吗?

I am experimenting with Java and MongoDB and I am making a lookup aggregation. I noticed that when I perform a lookup the document returned contains the lookup field as an Array of documents - as a java.util.ArrayList.
So my question here is - what if I have a case where in my lookup array I will have many documents loaded ? This may be a problem for my java heap memory ?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别忘他 2025-02-10 06:54:36

只要单个文档的大小和结果集的大小在运行时允许的边界内,您就不会在响应中看到任何疲倦。还要记住,bson文档尺寸的MongoDB驱动程序的16MB和管道阶段内存限制为100MB,而无需AllyDiskuse命令。

请参阅mongodb doc:

As long as the single document's size and result-set size is within permissible boundaries of your runtime, you shouldn't see any sluggishness in the response. Also keep in mind the MongoDb driver limitions of BSON Document size of 16MB and pipeline stage memory limit of 100MB without the allowDiskUse command.

Refer the MongoDb doc: https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/aggregation/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文