Memory Optimizations

With a lots of Out-of-memory errors I have been getting, I decided to try optimizing the memory usage to help reduce the problem;

  • Grid coordinate (GridIndex) size is reduced from 4 to 2 bytes.
    Grid size is now limited to 128×128.
  • Weight data (RouteWeight) size is reduced from 16 to 8 bytes.

Finally, I have also remove dependancy of generic C# LinkedList class from my Tree data storage (SortedTree); By replacing SortedTreeNode.Children with internal child and sibling variables (FirstChild, LastChild, NextSibling and PreviousSibling). This last change result in approximately 50 – 100 MB reduction in memory usage.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s