Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #9326

Re: GDI Objects creeping up

From "Jamal Assaf" <someone@example.com>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: GDI Objects creeping up
Date 2016-05-04 21:34 -0400
Organization albasani.net
Message-ID <nge7vm$bld$1@news.albasani.net> (permalink)
References <nga8uu$n54$2@dont-email.me> <nqejibh2atflb7j8klqdmgc5sdfecsjh6j@4ax.com> <ngchkd$h49$1@dont-email.me> <d25kib951f5n3vmffkpsivovkgl5km3p55@4ax.com>

Show all headers | View raw


Hi Benito,

I have not read any posts that DIM itself make objects go out of scope upon 
returning from a method. May be you could point out where you read this 
info.

Here is my understanding:

LOCAL variables regardless of their type will be collected by the GC 
(Garbage Collector) at a certain point.

What would be better is to help the GC by setting oFont := NULL_OBJECT 
before returning from the method or function. He's using one object: oFont.

Inserting CollectForced() in strategic places could also be used to force 
the GC to clean up especially when large arrays are used or brush, font, 
color objects are used.

Jamal

"Benito Fernández Meneses"  wrote in message 
news:d25kib951f5n3vmffkpsivovkgl5km3p55@4ax.com...

Martin,

In my methods I always use local variables declared as DIM, at some
post I read that using a Font, Brush, Color, etc. use a declare
statement  as

LOCAL DIM aFonts[3] AS Font

It get released as the method goes out of scope.

HTH
Benito


On Wed, 4 May 2016 11:10:52 +0100, Martin <Martin@spam.spam> wrote:

>Some good food for thought there Karl
>
>Well on one screen I have code like below
>
>This is in a bbrowser cell
>
>oFont := Font{,8,"MS Shell Dlg"}
>
>bcVal:AddValue(bCompoundValue{cDriver,;
>    Point{ 0,48},;
>    Dimension{67,16},,,,oFont})
>
>bcVal:AddValue(bCompoundValue{cLorry,;
>    Point{68,48},;
>    Dimension{61,16},BALIGN_RIGHT,,,oFont})
>
>Not sure if this is good or not.
>
>Thanks
>
>Martin
>
>On 04/05/2016 10:21, Karl Faller wrote:
>> Martin,
>> just some ideas;
>> look at
>> https://support.microsoft.com/de-de/kb/2719248
>> possibly related?
>>
>> Then i read in the help:
>> ...
>> Notes
>> Deselecting a Font:        In Windows, the current font should be
>> deselected before destroying the window.  To do this, use Window:Font
>> to assign the previous font, for example.  However, this is only
>> necessary if there is a font other than the default one currently
>> selected.
>> ...
>> It won't say, "why" you have to deselect - maybe because the font
>> won't get released automatically?
>>
>> And you are sure, you destroy explicitely things like brushes etc.?
>>
>> KArl
>>
>>> Hello
>>>
>>> I use the following to monitor GDI Objects
>>>
>>> GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS)
>>>
>>> And now we are finding that is it creeping up a lot.
>>>
>>> Any ideas what to check, I know there must be a leak, but where do I 
>>> look?
>>>
>>> Thanks
>>>
>>> Martin
>> Regards
>>
>> Karl
>> 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

GDI Objects creeping up Martin <Martin@spam.spam> - 2016-05-03 14:30 +0100
  Re: GDI Objects creeping up "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> - 2016-05-04 08:58 +0200
    Re: GDI Objects creeping up Martin <Martin@spam.spam> - 2016-05-04 09:07 +0100
    Re: GDI Objects creeping up Martin <Martin@spam.spam> - 2016-05-04 11:05 +0100
  Re: GDI Objects creeping up Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2016-05-04 11:21 +0200
    Re: GDI Objects creeping up Martin <Martin@spam.spam> - 2016-05-04 11:10 +0100
      Re: GDI Objects creeping up Benito Fernández Meneses <bfernandez@bfmconsultores.com.mx> - 2016-05-04 10:29 -0500
        Re: GDI Objects creeping up "Jamal Assaf" <someone@example.com> - 2016-05-04 21:34 -0400
          Re: GDI Objects creeping up Camille Kater <katercam@pt.lu> - 2016-05-05 09:52 +0200
          Re: GDI Objects creeping up Otto Christiaanse <ofchristiaanse@gmail.com> - 2016-05-05 03:47 -0700
            Re: GDI Objects creeping up "Jamal Assaf" <someone@example.com> - 2016-05-07 13:09 -0400
              Re: GDI Objects creeping up "Jamal Assaf" <someone@example.com> - 2016-05-08 00:50 -0400
                Re: GDI Objects creeping up Otto Christiaanse <ofchristiaanse@gmail.com> - 2016-05-17 02:33 -0700
        Re: GDI Objects creeping up Martin <Martin@spam.spam> - 2016-05-05 09:37 +0100
  Re: GDI Objects creeping up "Jamal Assaf" <someone@example.com> - 2016-05-07 13:12 -0400

csiph-web