• 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.
  • Posts

    • This DDR5-6400 CL36 32GB RGB RAM that supports both AMD and Intel is only $72 by Sayan Sen Recently, we covered several SSD deals, both internal and external. These include the Crucial X9 Pro and X10 Pro, the P310 2280, and the Samsung 990 EVO Plus. Meanwhile if you are looking for RAM to upgrade your desktop PC or build a new one, the PNY XLR8 Gaming EPIC-X RGB DDR5-6400 Kit can be your go-to choice as it is currently just $72 (purchase link down below). In terms of specs, this dual-RAM kit delivers 32GB of total DDR5 capacity (each module is 16GB) running at 3200 Hz to deliver 6400 MT/s (PC5-51200) at 1.4 volts. Pre-programmed Intel XMP 3.0 and AMD EXPO memory overclocking preset profiles mean you can fire up the kit to its rated speed with a simple BIOS tweak, rather than having to deal with manual timing adjustments. The CAS latency for this DDR5-6400 kit is 36, which is quite tight for a preset profile. Thermal performance is said to be stellar thanks to the aluminum heat spreader, which should help dissipate heat during extended gaming sessions. Additionally, the heat spreader is also said to feature an "embossed pennant design that enhances the overall look and complements the lighting of other components." Speaking of lighting, the included EPIC-X RGB model features ARGB LEDs diffused through a geometric polymer light pipe and allows syncing via Asus Aura Sync, Gigabyte RGB Fusion, MSI Mystic Light, or ASRock Polychrome Sync software. Get the PNY RAM at the link below: PNY XLR8 Gaming Epic-X RGB™ 32GB (2x16GB) DDR5 RAM 6400 CL36-48-48-104 Desktop Memory Kit (MD32GK2D5640036XRGB): $72.24 (Sold and Shipped by Amazon US) (MSRP: $109.99) This Amazon deal is US-specific and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon US deals page here. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
    • Vivaldi 7.5 is out with colorful tab stacks, improved tab menu, and more by Taras Buria Vivaldi Technologies has released a new feature update for the Vivaldi browser. Version 7.5 is now available with some much-requested features by the community, privacy improvements, bug fixes, and other changes. The release is not the biggest one, but it still packs useful changes, such as colorful tab stacks, a reworked tab context menu, and multiple improvements under the hood: Vivaldi now supports colorful Tab Stacks. This feature groups related tabs and helps you keep everything well-organized. Now, besides giving your stacks names, you can assign colors, which makes it easier to find the stack you need. Developers also added a new dialog: right-click a stack, click "Edit Stack," and give it a new name or choose a color. The browser also received a cleaner and better-organized tab context menu. Vivaldi says the new version is more intuitive and easier to use. Another important change is the ability to define a custom DNS provider with support for DNS over HTTPS. Finally, here are some of the under-the-hood improvements in Vivaldi 7.5: Address Bar: Fixed focus weirdness, suggestion hiccups, and dropdown quirks Ad Blocker: Now supports badfilter, strict3p, and strict1p rules Bookmarks & Notes: Better drag-and-drop, with clearer visual feedback Mail & Calendar: Smarter threading, invite handling, and polish throughout Dashboard & Widgets: Layout tweaks, transparency improvements, drag-and-drop goodness Quick Commands: Now shows synced tabs and handles errors more gracefully Settings: UI improvements across the board, from DNS input to workspace rules visibility You can find the complete changelog for Vivaldi 7.5 in a blog post on the official website. If you want to try this highly customizable browser, download it using this link.
    • "While users may say they do not want their data used for personalized ads, Meta believes that without personalization, user experience declines with an almost 800% rise in ads being marked as “irrelevant” or “repetitive”. The ads might be more irrelevant, but it's not like people crave ads in the first place. My user experience with ads isn't better with personalization, because I don't want them there to begin with. So I might as well have non-personalized ads if I am gonna have ads, because then I at least get tracked less, and that makes it a better user experience for me.
    • The fact that they didn't offer a non-personalized ad-supported option, when they were mandated by law, was the final nail in the coffin in my case.
  • Recent Achievements

    • Week One Done
      BeeJay_Balu earned a badge
      Week One Done
    • Week One Done
      filminutz earned a badge
      Week One Done
    • Reacting Well
      SteveJaye earned a badge
      Reacting Well
    • One Month Later
      MadMung0 earned a badge
      One Month Later
    • One Month Later
      Uranus_enjoyer earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      446
    2. 2
      ATLien_0
      161
    3. 3
      +FloatingFatMan
      147
    4. 4
      Nick H.
      65
    5. 5
      +thexfile
      62
  • Tell a friend

    Love Neowin? Tell a friend!