• 0

[VB6] Image Out of Memory


Question

Hello gang,

I am stuck keeping alive a VB6 app (that should have never been written in VB6, but that's another story) It is a medical app that stores many, many images. One user is occasionally getting an "Out of Memory. Error 7"

The error occurs here:


'vdata is the directory path
Image1.Picture = LoadPicture(vdata)
[/CODE]

The image that SOMETIMES errors is a 12 mp, however right now I have the image loaded multiple time along with other images and the application is reporting 1.2 GB of memory within Task Manager. I Googled this issue and I went looking for the specific limitations of the VB6 Image control (not the PictureBox) and came back without the specifications.

Any thoughts?

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

6 answers to this question

Recommended Posts

  • 0

Have you tried adding extra debug to the program to see if it's directly tied to the loading of the image? Also if the program is reporting 1.2gb of memory usage, are you sure the computer it's running on has enough memory available to run the program?

  • 0
  On 09/01/2012 at 17:04, firey said:

Have you tried adding extra debug to the program to see if it's directly tied to the loading of the image? Also if the program is reporting 1.2gb of memory usage, are you sure the computer it's running on has enough memory available to run the program?

It's an external client so I have minimal access to it's tech specs. My development machine here is a POS with ony 1gb ram, so WIndows is having to use VM to get that large a load (and WOW does it show when I get it to that level)

Because it's an external client the possability to add extra debugging info is highly unlikely, besides I can see that it is the mentioned like of code (LoadPicture) and not always that image. It seems to only occur when I push the app to load more that 800mb of data.... but not always then.

  • 0
  On 09/01/2012 at 17:11, firey said:

Have you tried loading a tonne of small images versus a few huge images? That way you can see if it has anything to do with actual image sizes / memory used per image, or if it's to do with number of images loaded.

Because the person who originally wrote this did not think about memory issue I added a thumbnail creator. When a patient is loaded ALL of their procedures are loaded, each procedure can have an infinite number of media. Since this is VB6 is is not threaded and at least now there are smaller images loading (it was getting BAD!) I cannot change this to load only 5 procedures to a "page" as it would take a huge rewrite (spaghetti anyone?)

So the base question I have is if anyone knows of specific memory issues/constraints with the VB6 Image control. I do know that VB6 can only have 256 controls on a form (I think that's the right number) and the number of images the users are loaded, regardless of their size, may be causing the issue.

Thanks for your thoughts Firey.

  • 0
  On 09/01/2012 at 16:54, James Rose said:

Hello gang,

I am stuck keeping alive a VB6 app (that should have never been written in VB6, but that's another story) It is a medical app that stores many, many images. One user is occasionally getting an "Out of Memory. Error 7"

The error occurs here:


'vdata is the directory path
Image1.Picture = LoadPicture(vdata)
[/CODE]

The image that SOMETIMES errors is a 12 mp, however right now I have the image loaded multiple time along with other images and the application is reporting 1.2 GB of memory within Task Manager. I Googled this issue and I went looking for the specific limitations of the VB6 Image control (not the PictureBox) and came back without the specifications.

Any thoughts?

vdata = Directory or File path?

Just to check (not trying to be a tool or anything D: )

  • 0
  On 09/01/2012 at 17:24, articuno1au said:

vdata = Directory or File path?

Just to check (not trying to be a tool or anything D: )

File Path. My bad for not stating that better.

Additional: This app is out on the wild with this code and has been for years. I'm guessing that with higher mega pixels and more images VB6 is hitting limits.

This topic is now closed to further replies.