Results 1 to 9 of 9
  1. #1
    Miles R is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    Mar 2019
    Posts
    263

    Form not releasing memory resources when closed and using too much memory for resources.

    I have a form with multiple (32) image box controls that are populated from bitmap files. These are linked, not embedded.


    When the form is loaded, the memory usage of access goes from 60Mb to 157Mb. Each image is 60Kb, so 32 should be about 2Mb.
    So why does Access need another 90Mb for these images?

    Secondly and more importantly, when the form is closed using dcmd.close the memory usage is still 157Mb. I would have expected it to drop back to 60MB. The problem is if I reopen the form, the memory usage goes up again to 240MB and so on up to about 1.3GB when Access complains that there are not enough system resources.

    Why is access not releasing this memory when the form is closed and is there anything I can do to force it to do so?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    You can do a Compact and Repair to recover space used by Access for temp files, edited queries/reports etc..

  3. #3
    Miles R is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    Mar 2019
    Posts
    263
    Thanks, but that does not solve or address the problem.

    I know I can compact and repair, but this problem is happening at run-time, whilst Access is open.
    Why does Access need 90mb for what is about 2mb of image files and why is it not releasing the memory when the form (Not Access) is closed. I want to be able to close and reopen the form many times in the same access session without access running out of memory.

  4. #4
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    Your db is probably caching image files in MSysResources. I would compact/repair, maybe do a dump of those records to Excel, then open your form. If it bloats again, I'd compare the table to the sample records. You will probably find a big difference. I have no idea if you can "tell" Access to not cache your files as I haven't worked with linked images too much, and simply code to compact on close if the db gets to a certain point. I realize that won't help you as you need to open the form again in the same session. Perhaps you can try running a delete query on form close to clear the cached image records, but I suspect that won't reclaim the space without compacting. Please let us know if I'm close in my guess as to the cause.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Miles R is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    Mar 2019
    Posts
    263
    Thanks Micron,

    I don't see the relevance of Compact/Repair to this. When I close Access, all the memory used is released anyway. I have Compacted/Repaired many times anyway and it has no effect on the problem. Linking images using VBA at runtime does not increase the size of the stored database, so Compact/Repair does not have anything extra to compact.
    But yes, it may have something to do with caching. Still not sure why in this database it needs about 3 Mb of memory resource for each 60Kb file it is linking. I think there is a bug in Access 2007 relating to this and it also should be releasing the memory when the form is closed.

    Didn't understand your first comment relating to "maybe do a dump of those records to Excel" - what records are you talking about here?

  6. #6
    Miles R is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    Mar 2019
    Posts
    263
    Think I may have solved the problem by accident.
    In the Access Options for the Current Database, there are two options :-
    1 Preserve source image format (smaller file size)
    2 Convert all picture data to bitmaps (compatible with Access 2003 and earlier)

    In my case the second option was selected. When I changed it to the first option, the problem went away.

    So it seems that when I link an image control to my bitmap file at runtime using VBA it was doing some extra work converting the file and probably caching it somewhere. Don't know why this would cost 3mb of memory for a 60kb file though.
    Now, with option one, it does not seem to be doing that and the memory used only goes up by about 3mb when opening my form (instead of 90mb) with 32 images controls. When I close the form, the 3mb memory is reclaimed.

    There is also an added benefit in that the form loads much faster.

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    Congrats. if you run this for a while and consider the issue "fixed", you could mark the thread Solved.
    Good info for others with similar situation.

  8. #8
    Miles R is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    Mar 2019
    Posts
    263
    Thanks,

    Yes it seems to be fixed so I will mark the thread as solved. Don't fully understand the reasons, but if there is a bug in Access 2007 it is not going to be fixed now.

  9. #9
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    I don't see the relevance of Compact/Repair to this
    Access can retain a lot of overhead, such as information about controls, what form they're on, properties etc.etc. You delete a form - the data stays. Compact/repair is supposed to clean this up, thereby reducing file size. Whether or not that has any effect on cached files that have been "removed" was the question. Probably not.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 02-26-2019, 11:54 AM
  2. VBA resources
    By Poohbear0471 in forum Access
    Replies: 2
    Last Post: 02-17-2019, 01:25 PM
  3. Resources Cost
    By salim in forum Database Design
    Replies: 2
    Last Post: 01-25-2014, 02:59 AM
  4. Dynamic Form and memory limit
    By pmi in forum Access
    Replies: 5
    Last Post: 10-07-2011, 09:49 AM
  5. Out of Memory + Form requery
    By jgelpi16 in forum Programming
    Replies: 4
    Last Post: 07-20-2011, 12:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums