• 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

    • I see, yeah that makes sense. I have been in situations where I barely did not crush badly on the road due to other driver starting to change lanes into another car - freaked out last second and avoided it by crashing into the side of the bridge instead. i got away because I quickly changed lanes 2 times in a couple of second and unlike that idiot I did not lose control big part of this was my car was good 😊 (audi a7) vs the old van the crashed driver was driving would AI be able to react and quickly change lanes twice both time barely avoiding collision … I don’t know my car systems pumped the breaks and tried to warn me with a beep and vibration but if I slammed the breaks the car behind me would hit me then again I have BMW driver training and a good car - so I have no idea how robot taxi would react i am not sure extreme fast lane changes would be programmed in - it is dangerous as hell unless you are FULLY aware, and have done it before but it is a general risk to do it especially in the conditions with bad weather and when you are not driving a sports car with 4 wheel drive and very good control
    • PDF Arranger 1.12.1 by Razvan Serea PDF Arranger merges or splits PDF documents and rotates, crops and rearranges their pages using an interactive and intuitive graphical interface. It is a front end for pikepdf. It's available for Linux and Windows. PDF Arranger features: Merge double-sided scanned document Delete pages from a PDF file Rotate pages in a PDF file Merge multiple PDF documents Zoom in / out Export selected pages from a PDF Undo/redo support Duplicate PDF pages Crop white borders Supports importing encrypted PDF files Create a booklet from multiple pages Allow to edit Keywords, Subjects and dates in document info ...and more PDF Arranger 1.12.1 changelog: Fix incompatibility with Python 3.13.4 on Linux #1238 Update Dutch and Italian translation Download: PDF Arranger 1.12.1 | 42.6 MB (Open Source) Download: PDF Arranger Portable | PortableApps.com View: PDF Arranger Website | Other operating systems | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • If you can't sleep, work, or make out with your lady in the back of the car, then it isn't actually "full self driving"...and shouldn't be marketed lied about that way. It's actually just "driver assisted".
    • I’m happy to admit that I truly hate musk from the bottom of my heart. He provided me with PLENTY reasons.
    • AIMP 5.40 Build 2683 is out.
  • Recent Achievements

    • Collaborator
      CHUNWEI earned a badge
      Collaborator
    • Apprentice
      Cole Multipass went up a rank
      Apprentice
    • Posting Machine
      David Uzondu earned a badge
      Posting Machine
    • One Month Later
      Stokenking earned a badge
      One Month Later
    • One Month Later
      Kevin Jones earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      538
    2. 2
      ATLien_0
      262
    3. 3
      +Edouard
      193
    4. 4
      +FloatingFatMan
      176
    5. 5
      snowy owl
      135
  • Tell a friend

    Love Neowin? Tell a friend!