Re: Win32lib memory?/statement!

new topic     » goto parent     » topic index » view thread      » older message » newer message

> "most" of the procedures? Please define "most" for me. 

OK, ALL of win32lib is redundant!

Just one of the millions

    hdc = getDC( Screen )
    releaseDC( Screen )

if you want to show several images on screen why
grab and release the ScreenDC everytime.

When I said most I should have said ALL.

I like win32lib dont get me wrong.


> I used to think that
> it meant more than 50%. Is it true that more than 50% of all procedures in
> Win32lib.ew implement redundant code? 

YES


> I guess it also depends on your
> definition of redundant too. 

Beating a dead horse........

> One definition I'd use is that redundant code
> is code that does nothing useful, either because some other code already did
> it or its effect has no effect on the program.

Yeah!

> I think what you saying is that ...
> 
> "Looks like if you already have a slew of items in the LV and"
> "if you then wanted to load some other data that"
> "the library would be freeing the memory for each existing item"
> "one at a time".
> 

In other words....

> Well actually the code only frees the removed item if it happens to be the
> last item in the list. However there is redundant code in this example. It
> could have been coded as ...
> 
> 
>      if iItem = length(lvitem_data) then
>          -- Free up last item in list --
>          lvitem_data = lvitem_data[1 .. length(lvitem_data)-1]
>          lvitem_owner = lvitem_owner[1 .. length(lvitem_owner)-1]
>      else
>          -- Mark this as a free item that can be reused. --
>          lvitem_data[iItem] = lvitem_BLANK
>          lvitem_owner[iItem] = -1
>      end if
> 

or when the LVItems are created return the address of the first item
calculating consumption up to the end of the last item
then free the space when not needed in one call to release_mem.....

I think I'll try to code this and give it to you.

> > I havent given this alot of time or thought but couldnt
> > you globally track spent memory? and free only once.
> 
> Sure. When would be a good moment to free it all up?
> 

My opinion is if you want to use deleteItems with -1 this must mean
that ALL of the items should go...

Why call the same procedure as many times as you have Items in the list.
duh

I like you Derek only because I strive to be as smart as you......:)


> ------
> Derek Parnell
> Melbourne, Australia
> "To finish a job quickly, go slower."

Euman

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu