Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Mappoint 2006 memory Leak?

This is a discussion on Mappoint 2006 memory Leak? within the MapPoint Desktop Discussion forums, part of the Map Forums category; I am using mappoint as an embedded part of my app. I'm currently doing a lot of FindNearby and FindPlaces ...

  1. #1
    EvetsMostel is offline Member Yellow Belt
    Join Date
    Oct 2005
    Location
    Eugene, OR
    Posts
    30

    Cool Mappoint 2006 memory Leak?

    I am using mappoint as an embedded part of my app. I'm currently doing a lot of FindNearby and FindPlaces calls. Over a course of several hours, mappoint goes from have 10MB of memory to over 400MB. Is there a way to release these "find" results? It's really the only thing I'm doing other than GoTo location calls.

    Steve

  2. #2
    Mattys Consulting's Avatar
    Mattys Consulting is offline Senior Member Black Belt
    Join Date
    Dec 2002
    Posts
    1,040

    Re: Mappoint 2006 memory Leak?

    Steve,

    Post your code, it's might be in there somewhere ...

  3. #3
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: Mappoint 2006 memory Leak?

    Yes, you need to clear/reference references to all MapPoint objects when you've finished with them.

    After saying that, MapPoint does tend to grow over time when you're doing batch work (eg. lots of route finding). For "application" MapPoint, there's a minimise/maximise trick which forces the garbage collector to run.
    An alternative is to stop it and restart it - this should also work for the control.


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  4. #4
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Re: Mappoint 2006 memory Leak?

    Quote Originally Posted by Winwaed View Post
    For "application" MapPoint, there's a minimise/maximise trick which forces the garbage collector to run.
    That is a nice trick, I will have to try it. I have always been closing and reopening it when I run into the problem of the MapPoint app growing into hundreds of MB and it slows down.

    Eric

  5. #5
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Mappoint 2006 memory Leak?

    Hi Steve,

    10MB of memory to over 400MB. Is there a way to release these "find" results
    do them in a separate object that you dispose once a while.

  6. #6
    EvetsMostel is offline Member Yellow Belt
    Join Date
    Oct 2005
    Location
    Eugene, OR
    Posts
    30

    Question Re: Mappoint 2006 memory Leak?

    Quote Originally Posted by Winwaed View Post
    Yes, you need to clear/reference references to all MapPoint objects when you've finished with them.

    After saying that, MapPoint does tend to grow over time when you're doing batch work (eg. lots of route finding). For "application" MapPoint, there's a minimise/maximise trick which forces the garbage collector to run.
    An alternative is to stop it and restart it - this should also work for the control.


    Richard
    Not sure how to "Clear/reference"... Any objects I create including "FindResults" are just declared on the stack during a member function, and thus are deleted when the function is complete. What exactly is the "minimise/maximise" trick? Are you saying that you show or hide the window? or are you maximizing the window? Wouldn't that be pretty ugly to the user?

    Steve

  7. #7
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: Mappoint 2006 memory Leak?

    Minimize/Maximize: Possibly, it depends on your application. Wilfried discovered it, so if you search the forums you'll find his solution. You have to send messages to MapPoint's window - the hide/show property isn't enough.

    Objects usually end up on the heap and not the stack - this is an important difference between objects and value types (like integer).
    MapPoint objects actually COM references.
    I'm not sure what language you're using, but in VB 6 you will need to set each object reference to nothing when you've finished with it, eg:

    set myPin = myMap.AddPushpin(....)
    ' (Do something interesting with myPin)
    set myPin = Nothing


    VB6 is then clever enough to delete the object when all references are removed.
    In C++, you would use "Release()" on the object reference - and you have to be a little bit more careful with other references.


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  8. #8
    EvetsMostel is offline Member Yellow Belt
    Join Date
    Oct 2005
    Location
    Eugene, OR
    Posts
    30

    Re: Mappoint 2006 memory Leak?

    Well, I am using C++, but can't call Release() (at least on the FindResults object), as it isn't part of the Class. So, not sure what you're referring to.

    Steve

  9. #9
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Mappoint 2006 memory Leak?

    Hi,

    This is a typical inter-application problem where no garbage collector can clean, unless it is in the object itself.

    Consider this function:
    Code:
    FindResults results = map.ObjectsFromPoint(x, y);
    It create a collection on the heap. When the function returns the address of the structure is in EAX register. the called application can and may not free this because the calling application need it.

    So there is no method provided in the FindResults to free it (and I doupt if this is possilbe in COM factory) it will persist in memory forever until the server is destroyed.

    So for 24/7 applications do these things in a separate object witch you once a while destroy.

  10. #10
    EvetsMostel is offline Member Yellow Belt
    Join Date
    Oct 2005
    Location
    Eugene, OR
    Posts
    30

    Re: Mappoint 2006 memory Leak?

    What other calls besides this one does this?
    FindResults results = map.ObjectsFromPoint(x, y);

    I use FindResults all over the place. Good C++ practice is that it detroys itself when deconstructed, unless it has a Release, function which it does not. Are you telling me that there is no way to clean this up?

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Memory leak - Bulk calculates
    By bigderek in forum MapPoint Desktop Discussion
    Replies: 7
    Last Post: 10-08-2008, 07:50 AM
  2. Memory leaks in MapPoint
    By rbarthels in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 01-27-2004, 05:53 PM
  3. Mappoint and VB.NET: Horrible Memory Usage
    By mrobold in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 11-12-2003, 06:16 PM
  4. memory leak with objloc.goto?
    By mzupan in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-02-2003, 01:14 AM
  5. Huge memory leak in using QueryShape?
    By random0000 in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 03-28-2003, 06:22 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59