1. Mary Jane Foster
  2. PowerBuilder
  3. Monday, 18 July 2022 16:56 PM UTC

Hello:

Back in March we migrated from PB 2017 to PB 2021 (we are now on MR 1509).  Since March some of our users are experiencing a situation where the picture buttons no long display words or images, and fonts become larger and are bold, and the main image never displays.  We have been using this application for years and this is new.  The first screenshot shows you what is happening.  The second screenshot shows you what it should look like when it's running smoothly.  We have looked for any places where we have missed garbage collection, deleting objects, etc., and it continues to happen  - sporadically.  We have yet to be able to duplicate it. 

Have you seen this behavior before?  Is this some type of memory issue and, if so, where do I look to monitor that information?   Any insight would be appreciated!

 

 

 

Thank you.

MJ

mike S Accepted Answer Pending Moderation
  1. Monday, 18 July 2022 17:38 PM UTC
  2. PowerBuilder
  3. # 1

how/where are the images stored/loaded?  are they all defined in a pbr file?

 

If not, is it possible you are changing the default directory in PB and that the image file names are not completely setup with the path?

for example:   myimage.png requires that the current directory has the file.

  C:\Users\username\AppData\Local\Temp\myimage.png   will show the image no matter what the default directory is if the image is downloaded on the fly

Comment
There are no comments made yet.
Mary Jane Foster Accepted Answer Pending Moderation
  1. Monday, 18 July 2022 17:45 PM UTC
  2. PowerBuilder
  3. # 2

Hello Mike:

Great questions.  The *.png files for the picture buttons are in the *.pbr file.

All the other images are retrieved from the database, from there we get their respective paths and pull them from the network.

We have been successfully doing it this way for 20 years, and no we are not changing the default directory in PowerBuilder.  

Hope that helps.

 

MJ

Comment
  1. mike S
  2. Monday, 18 July 2022 19:20 PM UTC
that seemed like a long shot, but figured i'd ask. it would not explain the bold/size changes in the font
  1. Helpful
There are no comments made yet.
Ronnie Po Accepted Answer Pending Moderation
  1. Monday, 18 July 2022 19:12 PM UTC
  2. PowerBuilder
  3. # 3

The described behavior and screenshots exactly resemble what would happen in earlier versions of Windows when the system was low on GDI resources. It could be that PB 2021 is less efficient in use of resources. Can you reproduce by opening a lot of graphics-heavy windows, running multiple apps, etc.?

Comment
There are no comments made yet.
Mary Jane Foster Accepted Answer Pending Moderation
  1. Monday, 18 July 2022 21:13 PM UTC
  2. PowerBuilder
  3. # 4

Hello Ronnie:

We've duplicated it inconsistently.  Now that I know to look for that, I can use Task Manager to do it.  However it would be great if we could do some kind of API call to get the current GDI resources.  I've done some research into that but I haven't found anything.  Do you happen to know of a way to do that?

wink

MJ

Comment
  1. Chris Pollach @Appeon
  2. Monday, 18 July 2022 21:51 PM UTC
Hi Mary Jane;

My STD Framework tracks all types of resources that your PB App uses. One of those is GDI (since 2020). If you run the OrderEntry demo App, you can see your App's GDI consumption in both the App log & in the App "About" information.

http://chrispollach.blogspot.com/2020/08/2020r2.html

If you need help locating the GDI code, please let me know. BTW: the framework is free & open source. So help yourself to any code that you find useful.

Regards ... Chris
  1. Helpful 1
  1. Mary Jane Foster
  2. Tuesday, 19 July 2022 12:30 PM UTC
Thank you Chris! I've asked our Network Team to download it asap. Another question , if it proves to be a GDI resource issue, what suggestions do you have to work around it?



And by the way, I cannot say enough how responsive the Appeon Community is. I appreciate it!



MJ
  1. Helpful
There are no comments made yet.
Mary Jane Foster Accepted Answer Pending Moderation
  1. Tuesday, 19 July 2022 14:18 PM UTC
  2. PowerBuilder
  3. # 5

Hello to all:

We were able to reproduce it the moment we hit the 10,000 GDI limit.  The interesting thing is we closed everything except the frame and it still has 9,312 GDI objects in memory.  We've been through the code and believe we have reset, destroyed, etc. all objects with regard to our images.  You would think by closing all the windows but the frame the number of GDI Objects would have decreased dramatically.  The frame itself is 198 GDI (at least it is when I first open the application).

Any suggestions on the quickest way to see what objects still exist?  Or is it a PBTrace?    Thanks.  cool

Comment
  1. Mary Jane Foster
  2. Tuesday, 19 July 2022 17:45 PM UTC
Hi Roland:



I should have included that in my original post. We are compiling to 64bit.



Thank you!



MJ
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 19 July 2022 20:32 PM UTC
Yes, while 64 bit extends your Apps memory for hold a lot more data, it does not control how many RCB'S one address space can have. Once you exceed that OS threshold... Kaboom!
  1. Helpful
  1. mike S
  2. Wednesday, 20 July 2022 13:22 PM UTC
PB.ini setting:



I assume you use datastores? Do you use the pb.ini in the RUNTIME directory? do you have this setting in the pb.ini, if not try it.



[DataStore Behavior]

UseHwnd=no
  1. Helpful
There are no comments made yet.
Mary Jane Foster Accepted Answer Pending Moderation
  1. Tuesday, 19 July 2022 16:06 PM UTC
  2. PowerBuilder
  3. # 6

Chris, 

Our Network/Security Manager is asking if we need to download all of the classes you have, or just those for the Order Entry?  

And if you could point me in the right direction for the GDI stuff, that would be great!

MJ

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 19 July 2022 20:29 PM UTC
Hi MJ;

The OrderEntry Demo App is built from the framework & uses 90% of it's features. So basically, you can see the framework "in action" as a normal PB App would use it.

I also have the "barebones" framework that would be used if you are going to build a PB app from scratch. Either way, the base libraries contain the same code.

The GDI resources are basically how the O/S tracks every visual object. Internally, they are tracked by RCBs (resource control blocks). Basically one RCE for each object's resources being held by the App or by the O/S on behalf of the App. These are what we call GDI resources and they are quite expensive by the OS to allocate / deallocate / manage (scan).

One way to help lower GDI' resources used is to try using the GarbageCollect() commands to force freeing memory when you detect a high usage.

The other approach is preventative by replacing common OS controls like CB, LB, RB, SLE, etc with one external DataWindow (for example). The DW object only uses a minute amount of resources vs all these native controls on a window surface (for example).

HTH

Regards... Chris

  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 19 July 2022 18:05 PM UTC
  2. PowerBuilder
  3. # 7

Hi, Mary Jane - 

I'm attaching a tiny sample app that shows how to invoke the GetGuiResources Windows API function. It's been tested both 32-bit and 64-bit.

I hope it helps.

Best regards, John

Attachments (1)
Comment
There are no comments made yet.
Mary Jane Foster Accepted Answer Pending Moderation
  1. Wednesday, 20 July 2022 17:37 PM UTC
  2. PowerBuilder
  3. # 8

Hi all:

First, thank you for all the suggestions.  We have tried everything and it looks like we've narrowed it down to a memory leak in a third party tool we use to display our images.  We've submitted a ticket their company but given past experiences we are not hopeful. 

Since everyone is so helpful here, I thought I'd ask another question of those who have experience with any 3rd party tools, or even with PB tools that display images.  Before answering though, here is additional information:

  • Our images are stored on the network and we have 2.5 million of them of varying sizes and clarity based on where they are being displayed, i.e., web vs our PB applications
  • We display large and thumbnail images.  And we can have thousands of images retrieved for display 
  • One thing I left out before is we are compiling as 64bit exe.

We're currently playing with PB's web control to see how that helps us, but so far the retrieval speed is significantly slower.  Any tips/tricks there would be great.  Any suggestions on 3rd party tools would be great too.

Happy Wednesday all!

 

MJ

Comment
  1. Mary Jane Foster
  2. Thursday, 21 July 2022 16:11 PM UTC
Hi Roland:



Your app uses the picture object and we tried building our image gallery using the native picture object but it was way too slow. It seems it can't handle loading all all the images into memory. So we tried web control and found it faster, but still not as fast as the 3rd party tool we have been using.



I appreciate your taking the time to send though. I am grateful for all the help I continue to receive from folks.

MJ
  1. Helpful
  1. Ronnie Po
  2. Thursday, 21 July 2022 16:22 PM UTC
Hi Mary Jane,



i don’t have any hard numbers on this, but I’ve found that a picture object in a DataWindow was significantly faster at displaying images than a picture control in a Window.
  1. Helpful 1
  1. Chris Pollach @Appeon
  2. Thursday, 21 July 2022 17:05 PM UTC
Adding to Ronnie's suggestion ... You can also try the InkEdit control or InkEdit DataWindow. ;-)
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.