• 0

[VB6] Out of Memory error


Question

Hello gang,

This is one of those sad moments; I'm stuck supporting a VB6 app that loads an unlimited number of images (Medical app: Patient can have unlimited procedures, each procedure can have unlimited media (images and videos) and when a patient loads ALL of the images load. I recently affected a thumbnail so the load would be eased (really, the original developer didn't think it would be an issue to load unlimited original images! <sigh>) So, when the app loads enough images I get an "Out of Memory. Error Number 7" during an image control's LoadPicture function

I KNOW that there is not much I can do without moving this app to .NET and having Pages so that not all of the media load at once.

What I am asking is if anyone knows of an article that describes the limitations of VB6's memory usage. I have found some, but I am looking for ammo to back me up when I go to management about this issue.

If you happen to have an idea on how better to deal with this, I'm open to that as well... I just don't have my hopes up.

Thanks.

Link to comment
https://www.neowin.net/forum/topic/1053773-vb6-out-of-memory-error/
Share on other sites

9 answers to this question

Recommended Posts

  • 0
  On 24/01/2012 at 19:33, James Rose said:

I KNOW that there is not much I can do without moving this app to .NET and having Pages so that not all of the media load at once.

Are you sure of that? I haven't done any VB6, but I'd be surprised if it was that crippled that there was no way to implement a custom loading scheme for images. After all, the user cannot be viewing all images of all procedure at once, so there must be some way to limit the loading to what is currently viewable on-screen. It might be a lot of work though, something you'd get for free with, say, a virtualizing stack panel in WPF, so you could still make a convincing case that the app should be moved to .NET based on the potential time savings.
  • 0
  On 24/01/2012 at 20:37, Dr_Asik said:

After all, the user cannot be viewing all images of all procedure at once

You would think that they don't look at everything at once... but they do (in the current system layout) Changing the design to only load 5 procedures would be a big deal (really, REALLY badly design) Changing this pattern may be the only way to go.

I have been trying to get this app moved to .NET for 3 years. <sigh>

  • 0
  On 24/01/2012 at 21:09, James Rose said:

You would think that they don't look at everything at once... but they do (in the current system layout) Changing the design to only load 5 procedures would be a big deal (really, REALLY badly design) Changing this pattern may be the only way to go.

I have been trying to get this app moved to .NET for 3 years. <sigh>

You mean that there are enough images physically on-screen at once to cause an Out-Of-Memory error? I mean, how many images can you cram in a standard resolution... assuming ridiculously small thumbnails like 25x25 pixels, filling the entire screen, having no margins whatsoever, and a large resolution like 1920x1200, you get 3686 images, which should still be manageable, and that's a very far-fetched number.
  • 0
  On 24/01/2012 at 23:21, Dr_Asik said:

You mean that there are enough images physically on-screen at once to cause an Out-Of-Memory error? I mean, how many images can you cram in a standard resolution... assuming ridiculously small thumbnails like 25x25 pixels, filling the entire screen, having no margins whatsoever, and a large resolution like 1920x1200, you get 3686 images, which should still be manageable, and that's a very far-fetched number.

The thumbnails are down to 200 pixels wide and a related height. And yes, there are enough images to cause an Out of Memory, as I mentioned in my original post when the patient's chart loads ALL procedures load, and ALL media from each procedure load. (UG!) I initially thought it was a large image or some form of corrupt image that was causing the problem, but it is not. I can load the same 14mp image many, many times before the error occurs. (arg)

  On 24/01/2012 at 23:28, htcz said:

Explain to managment that this program has security bugs as VB support died in 2008.

If only that would work. I have told them that VB6 died a dozen years ago when .NET was released so... <sigh> To give you an idea on how messed up this is, the "back-end" is MS Access. It was originally built in 2003 and the CTO (who built this) had never heard of SQL Server Desktop Edition or SQL Server Express.

Thanks thought.

I believe I am going to have to tell them that there is no other way than to build anew

  • 0

Are you using bitblt to draw the thumbs or using a picture box control for every thumb nail ?

  On 24/01/2012 at 19:33, James Rose said:

Hello gang,

This is one of those sad moments; I'm stuck supporting a VB6 app that loads an unlimited number of images (Medical app: Patient can have unlimited procedures, each procedure can have unlimited media (images and videos) and when a patient loads ALL of the images load. I recently affected a thumbnail so the load would be eased (really, the original developer didn't think it would be an issue to load unlimited original images! <sigh>) So, when the app loads enough images I get an "Out of Memory. Error Number 7" during an image control's LoadPicture function

I KNOW that there is not much I can do without moving this app to .NET and having Pages so that not all of the media load at once.

What I am asking is if anyone knows of an article that describes the limitations of VB6's memory usage. I have found some, but I am looking for ammo to back me up when I go to management about this issue.

If you happen to have an idea on how better to deal with this, I'm open to that as well... I just don't have my hopes up.

Thanks.

  • 0
  On 25/01/2012 at 14:12, rbrucemtl said:

Are you using bitblt to draw the thumbs or using a picture box control for every thumb nail ?

An Image control is being used. While drawing the image might be an idea, it may not be realistic. But I will look into it. Thank you.

  • 0
  On 25/01/2012 at 13:57, James Rose said:

The thumbnails are down to 200 pixels wide and a related height. And yes, there are enough images to cause an Out of Memory, as I mentioned in my original post when the patient's chart loads ALL procedures load, and ALL media from each procedure load. (UG!) I initially thought it was a large image or some form of corrupt image that was causing the problem, but it is not. I can load the same 14mp image many, many times before the error occurs. (arg)

Yes, but my point is that you may not need to load images that are not currently, physically on-screen, even if they are on the page they may be off-screen (and you need to scroll to see them for instance). This is probably not a behavior you get out of the box with any VB6 control, but something that could be coded nonetheless.

Alternatively, you could rewrite it so that it loads a picture, creates the thumbnail, and then unloads the picture before opening the next one. That way you only keep the thumbnails in memory, and when the user requests to see a picture in full, then you load that picture specifically (and unload it as soon as he's done viewing it).

Both cases require a significant refactoring effort, but I don't see how it couldn't be just because it's VB6. Unless for some reason you cannot manually unload an image?

  • 0
  On 25/01/2012 at 19:00, Dr_Asik said:

Yes, but my point is that you may not need to load images that are not currently, physically on-screen, even if they are on the page they may be off-screen (and you need to scroll to see them for instance).

Ah, now I see your point. That might be an option, thank you.

I do feel that any actual answer is a short term solution, but that you kindly. I will give it some thought.

This topic is now closed to further replies.
  • Popular Now

  • Posts

    • For those still looking to get a 5090 at or around MSRP, there's one on scan.co.uk for £1,874.99 its pre-order though with expected shipping date of June 27. https://www.scan.co.uk/products/nda-zotac-nvidia-geforce-rtx-5090-solid-32gb-gddr7-graphics-card
    • Kudos are due because I always expect you to jump to Microsoft's defense in the many, many, many Win11 hate posts. Thanks for holding back for once.
    • Windows 11 finally gets a small, but long-requested Windows 10 taskbar feature by Taras Buria Windows 11 turns four later this year, but some of the features that Microsoft removed during the transition remain missing to this day. However, the company is slowly but steadily restoring some of the most requested bits and pieces. The latest omission that is finally being addressed is the missing clock in the calendar flyout. Windows enthusiasts spotted the first traces of a calendar clock coming to Windows 11 in April. Now, with the latest builds released in the Dev and Beta channels a few days ago, Microsoft is officially restoring the calendar flyout clock. You can now have a bigger clock with seconds displayed, just like in Windows 10 (Microsoft tried to remove that for some reason but quickly restored it). When enabled, the clock appears with the calendar collapsed or expanded. Microsoft is not only restoring the calendar clock but also improving it. Those who do not want it can go to Settings and toggle the clock off for a cleaner look. You can customize this feature in Settings > Time & Language > Date & Time. Note that the feature is rolling out gradually, so not all insiders have access to it right now. However, you can turn it on with the ViVeTool app: Download ViveTool from GitHub and unpack the files in a convenient and easy-to-find folder. Run Command Prompt as Administrator and navigate to the folder containing the ViveTool files with the CD command. For example, if you have placed ViveTool in C:\Vive, type CD C:\Vive. Type vivetool /enable /id:42651849,48433719 and press Enter. Restart your computer. Unfortunately, the taskbar calendar remains pretty spartan in terms of features. It still does not display your agenda and does not allow creating new events. All that Windows 11 users have is a dumb calendar and a couple of buttons for the Focus Assist feature. As such, the only way to improve it is to use third-party applications. Did you miss the calendar flyout clock in Windows 11?
    • To the extent that we are talking about beta software, this article falls more in the realm of nerds sharing thoughts and tricks. I love seeing articles like this, people should very openly share what they like and dislike about the new look. We all know Apple tends to be stubborn, but maybe they still make minor tweaks to improve the readability.
  • Recent Achievements

    • Apprentice
      Wireless wookie went up a rank
      Apprentice
    • Week One Done
      bukro earned a badge
      Week One Done
    • One Year In
      Wulle earned a badge
      One Year In
    • One Month Later
      Wulle earned a badge
      One Month Later
    • One Month Later
      Simmo3D earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      611
    2. 2
      ATLien_0
      284
    3. 3
      +FloatingFatMan
      179
    4. 4
      Michael Scrip
      151
    5. 5
      Steven P.
      112
  • Tell a friend

    Love Neowin? Tell a friend!