Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutOfMemoryException when declaring large managed arrays #2

Open
johnearnshaw opened this issue Nov 10, 2015 · 3 comments
Open

OutOfMemoryException when declaring large managed arrays #2

johnearnshaw opened this issue Nov 10, 2015 · 3 comments

Comments

@johnearnshaw
Copy link

I'm eager to see this project working :)
So... I was playing with the dev branch and I'm unable to load the pre-trained GoogleNews-vectors-negative300.bin (300-dimensional vectors for 3 million words and phrases) due to the memory allocation restriction in managed arrays.

Have you considered using System.IO.MemoryMappedFiles.MemoryMappedFile to overcome this rather than declaring large arrays?

@eabdullin
Copy link
Owner

@johnearnshaw, hi. I tried to load my trained 200-dimensional vectors for 1 million words - was ok. So, i think your computer doesn't have enough memory, because algorithm uses manage arrays and allocate memory for needed size

Array.Resize(ref _vocab, _vocabMaxSize);

@tomachristian
Copy link

Well, still doesn't work for GoogleNews-vectors-negative300.bin

@GuntaButya
Copy link

2GB is the max Memory Size for an Object, you will need to split the Dataset, or use a smaller one.
See: http://stackoverflow.com/questions/982051/net-max-memory-use-2gb-even-for-x64-assemblies

long memory = GC.GetTotalMemory(false);
// Load your DataSet...
Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "Corpus Memory Use: {0:0.0} G-bytes", ((Convert.ToDouble(totalMem) / 1024.0) / 1024.0) / 1024.0));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants