Re: string dictionary and memory issue.
- From: "Jon Skeet [C# MVP]" <skeet@xxxxxxxxx>
- Date: 10 Mar 2006 01:12:31 -0800
Alexandre Brisebois (www.pointnetsolutions.com) wrote:
I am currently building a lexical analysis component to pull keywords
out of content,
I currently have a functional first build, but I am having problems
ince I am easily loading over 300 000 strings in memory,
when I am doing the actual analysis I can reach upto 400 mb of ram
usage.
I currently have built my dictionary out of a tree built by nodes
containing hashtables. each node represents a letter of the string and
a flag representing the end of a string.
How many entries are in each node? I wouldn't expect there'd be that
many - particularly if you're only dealing with ASCII characters. I'd
suggest using a plain array, either as a list of entries (for nodes
without many sub-entries) or an array with nulls in (for those where
traversing a list would be expensive). You could use ArrayList/List<T>
instead of the straight arrays, but call TrimToSize on all of them when
you've finished loading the list of words to avoid wastage.
Jon
.
- Follow-Ups:
- Re: string dictionary and memory issue.
- From: Alexandre Brisebois (www.pointnetsolutions.com)
- Re: string dictionary and memory issue.
- References:
- string dictionary and memory issue.
- From: Alexandre Brisebois (www.pointnetsolutions.com)
- string dictionary and memory issue.
- Prev by Date: Strange exception (about webservices, temp directory and XML serialization)
- Next by Date: Re: PInvoke - Pinning byte arrays
- Previous by thread: string dictionary and memory issue.
- Next by thread: Re: string dictionary and memory issue.
- Index(es):
Relevant Pages
|