Author Topic: GDI functions & Init problems?  (Read 16280 times)

0 Members and 3 Guests are viewing this topic.

Mike Lobanovsky

  • Guest
Re: GDI functions & Init problems?
« Reply #45 on: May 14, 2015, 01:50:03 PM »
I will try indexbase 0 & 1 and what is the difference ...

Hi,

On default, O2 assumes arrays start at index 1. indexbase lets you change this default behavior. If you are using arrays that start at index 0 but you haven't specified indexbase 0 then in the For/Next loop that Charles showed, O2 may either i) skip working for arg0[0] and develop memory leaks here (at best), or ii) crash completely (in the worst case). Either way, O2's behavior will be, technically speaking, undefined.

Try to always match you arrays with an explicit declaration of the respective indexbase. We will all be getting significantly fewer headches if we do it too. Don't rely on the language defaults; be very specific about everything you do in your code.

Do not use string assignments that generate temporary strings in For/Next, While/Wend, Do/End Do loops! OxygenBasic cannot automatically collect temporary string garbage generated internally in such loops!

Aurel

  • Guest
Re: GDI functions & Init problems?
« Reply #46 on: May 14, 2015, 09:20:04 PM »
Mike i check everything yesterday 4  times...
and download latest realease and problem is present
and i repeat....how then work fine with older dll without mem leak
dll which work is from old PeterW version oxyBasic.
 ::)

Charles Pegge

  • Guest
Re: GDI functions & Init problems?
« Reply #47 on: May 14, 2015, 09:36:51 PM »
Hi Mike,

If strings are dim'ed before the loop then all is well.

But when dim'ed or auto-dim'ed inside a loop, the string's reference will be reset, and a new entry will be made on the Garbage Collector list. This is tolerable, though undesirable, for small iterations on local strings, but otherwise builds up a mountain of uncollected garbage.

Apart from global and local string GC lists, there is a list for temporary strings, which are to be freed after an expression.

Hi Aurel,

I've now tested all O2 string functions, and have not detected any leaks. However I detected one issue with local string arrays getting logged to the global GC, but all your arrays appear to be global anyway.

Oxygen DLL Update (200k)
http://www.oxygenbasic.org/o2zips/Oxygen.zip



Aurel

  • Guest
Re: GDI functions & Init problems?
« Reply #48 on: May 14, 2015, 10:03:43 PM »
yes Charles all my arrays are global and there is no any direct imapact on interpreter loop.

JRS

  • Guest
Re: GDI functions & Init problems?
« Reply #49 on: May 14, 2015, 10:15:25 PM »
@Aurel - Do you know where in your interpreter the leak is occurring? Is your claim based on "this is the memory available when I start the program and this is what it increased by once it ended"? Are you using any type of debugger in troubleshooting the issue your having? I guess what I'm asking, is this more than just a feeling you have or can you post a code snippet of it failing?


Aurel

  • Guest
Re: GDI functions & Init problems?
« Reply #50 on: May 15, 2015, 12:50:44 AM »
John
open task manager and run ...then you will see how memory using grove...
simple ...
what kind of debugger  ???

JRS

  • Guest
Re: GDI functions & Init problems?
« Reply #51 on: May 15, 2015, 12:59:54 AM »
John
open task manager and run ...then you will see how memory using grove...
simple ...
what kind of debugger  ???

Oh, I got it. You have no idea or proof O2 is leaking memory other than task manager which accumulates all processes used memory.

You need to do better than that if you want to call yourself a programmer.


Aurel

  • Guest
Re: GDI functions & Init problems?
« Reply #52 on: May 15, 2015, 02:49:02 AM »
Quote
You need to do better than that if you want to call yourself a programmer
oh tutie-frutie managero  :P

enough for me
sorry but i am not creator of o2 , so how i know what is where  :o
SLS   ;D

JRS

  • Guest
Re: GDI functions & Init problems?
« Reply #53 on: May 15, 2015, 10:18:22 AM »
Quote
You need to do better than that if you want to call yourself a programmer
oh tutie-frutie managero  :P

enough for me
sorry but i am not creator of o2 , so how i know what is where  :o
SLS   ;D

Unlike many of the Windows offerings, O2 comes with source and the only limitation is your curiosity and willingness to learn.

Charles Pegge

  • Guest
Re: GDI functions & Init problems?
« Reply #54 on: May 23, 2015, 01:31:10 AM »
Hi Aurel,

I've made some progress, leak hunting in Ruben3.

 I traced down to a dropped optimization affecting instr(). When the optimization was restored, the memory leak disappeared, (testing with fern.RUB).

However, this only masks the underlying problem, adversely affecting instr(). So further investigation is required.

14 May 2015:
http://www.oxygenbasic.org/o2zips/Oxygen.zip

Aurel

  • Guest
Re: GDI functions & Init problems?
« Reply #55 on: May 23, 2015, 01:45:23 PM »
Hi Charles
I am glad that you find where problem is ...so
instr()...
i really don't have a idea what might be wrong when old release work as expected.
i must say that i have one experimental version of ruben written in old Emergence Basic
where i have only few commands including forLoop ...Diffrence...
ufff is BIG...
that version take only 2300k and there is no any sign of mem leak.
String operations in EB are very good BUT speed of execution is better with o2  :D
I don't have Power Basic but from what i read and what i can see in Eros work (tB)
i can say that i would like that o2 have such a speed with strings..
all best.. ;)
« Last Edit: May 23, 2015, 02:11:07 PM by Aurel »

JRS

  • Guest
Re: GDI functions & Init problems?
« Reply #56 on: May 23, 2015, 02:03:21 PM »
Good job Aurel sticking to your guns and blowing off people like me saying it must be you.  :-*

Quote from: Aurel
I don't have Power Basic

You would probably have better luck finding a copy on the torrents then getting anyone at PowerBASIC to sell you one.

Aurel

  • Guest
Re: GDI functions & Init problems?
« Reply #57 on: May 23, 2015, 02:18:33 PM »
Yes Charles
 tested new dll and it seems that mem leak gone
mem usage is fixed to 4088k on my computer and work very fast.
Of course i will test tomorow whole code of ruben4.