WPF Map Control memory cache limit?

Within this forum we want to offer discussions all around our .NET based Map control including all .Net-language specific questions concerning calls of the xServer-API. Attention: xServer-relevant concepts can be found in further forums such as xRoute or xTour.
Post Reply
kecskemetib
Posts: 6
Joined: Fri May 30, 2014 1:01 pm

WPF Map Control memory cache limit?

Post by kecskemetib »

Dear Forum,

We are using the WPF MAP control (Ptv.XServer.Controls.Map.WpfMap) in one of our .NET 4.5 applications. We have noticed, that the control is caching the map images in the memory as the user is using the map. We would like to limit the WPF MAP control's memory usage to a fixed amount, like 100 MB, but we didn't find any solution for this problem.
It is very important to our client because their users are using shared memory and without this limitation a user can consume a huge amount of memory from other users.

Is there any documentation or sample code on how we can configure the memory limit with the map contol?

Thank you,
Balázs
User avatar
Oliver Heilig
Posts: 160
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: WPF Map Control memory cache limit?

Post by Oliver Heilig »

Hi Balázs,

The tile cache for the WPF control has size of 500 tiles. If you assume 20KB for an average tile image you'll never get more than 10MB. You cannot directly change the cache size. But you can inherit you own class and set it as global cache, see code below.

Code: Select all

    public class MyCache : TileCache
    {
        public MyCache(int size)
        {
            CacheSize = size;
        }
    };

        public MainWindow()
        {
            Ptv.XServer.Controls.Map.Tools.TileCache.GlobalCache = new MyCache(100);

            // Initialization.
            InitializeComponent();
Post Reply