Array which Pages to Disk

匿名 (未验证) 提交于 2019-12-03 02:54:01

问题:

Does anyone know of a .NET array class/library which will page its contents out to disk?

The idea is to be able to use it as a normal array but the class uses less RAM (to avoid getting out-of-memory exceptions with more than 2GB of data). Ideally the class will implement one of:

  • System.Collections.Generic.IList
  • System.Collection.IList

Any ideas much appreciated!

回答1:

I haven't come across anything like that, but I guess that's because it's rarely needed. After all, a database table (in SQL Server or any other database) is in essence a disk-based array.

You could write an IList<> wrapper around a database table. Throw in some caching and you have a perfect disk-based array.



回答2:

Unless you're dealing with fixed length records (and even then there's issues) you're going to run into a lot of problems with treating 2GB of data like an array that make a lot of array uses perform horribly -

  • IndexOf()
  • InsertAt()
  • RemoveAt()
  • Sort()

Is there any reason a database wouldn't work?



回答3:

I found this solution in VB of a file-based array: http://www.vbforums.com/showthread.php?t=504649

But it seems hacky... Still looking for another implementation.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!