Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    OCX & Memory Management (XP, 2003)

    This is probably flogging a dead horse, but I will try anyway....

    I've been trying to use a 3rd party OCX that performs some very useful mapping/GPS/GIS functions. Unfortunately, it also has some memory problems -- every time it performs a certain action, it allocates some memory that it never releases. This is repeated in a loop in my program, until memory is exhausted, and Windows and/or Access crashes. Not pretty. The only solution I have found so far is to interrupt the loop in midstream, exit from the program and Access, and then start again. Not too convenient!!

    I've been in discussion with the author, and some work is being done on their side. It's an open source OCX from a university group, so there is no financial clout to exercise. Fixing the open source OCX is beyond my abilities. But I don't hold out a lot of hope since the standard answer is to switch to VB.NET.

    My question: is there any way to tell Access to clean up its memory? Something like a Garbage Collection routine that I have seen referenced in other languages.

    (Of course, the obvious answer is to stop using that particular OCX -- but enquiring minds want to know!!)
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: OCX & Memory Management (XP, 2003)

    If you have code like this:

    Dim obj As ObjectFromOCX
    Set obj = ...
    Do
    ...
    Loop
    Set obj = Nothing

    you could try setting and clearing the object within the loop:

    Dim obj As ObjectFromOCX
    Do
    Set obj = ...
    ...
    Set obj = Nothing
    Loop

    It'll have a negative impact on performance, but perhaps it stops the memory leak. Other than that, I wouldn't know.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OCX & Memory Management (XP, 2003)

    Yeah, I tried something like that to no avail. Thanks for the effort, though!
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: OCX & Memory Management (XP, 2003)

    I guess you'll have to wait for the author to come up with a bug fix.

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: OCX & Memory Management (XP, 2003)

    Access doesn't really have much in the way of garbage collection because you're still working in VBA. Sorry to repeat conventional wisdom, but .Net *does* have very good garbage collection. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Charlotte

  6. #6
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OCX & Memory Management (XP, 2003)

    And so they have...

    For anyone who is interested in GIS/Mapping applications, I have been working with MapWindow (http://mapwindow.org/). It's an open source project that produces an OCX for creating, displaying, manipulating, and analyzing industry-standard Shapefiles. So far, I have been very impressed with it.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

Posting Permissions

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