View Full Version : iteration time
Hi
i have tried the iteration example in Oxygen with a small variation like this:
'ITERATION:
' APPENDING TO STRING
uses "oxygen","file"
dim src as string
src = "
dim i as long
dim s as string
for i=1 to 1000
's+=str(i)+chr(13)+chr(10)
s+=str(i)
next
print s
terminate
"
o2_basic src
o2_exec
it takes about 20 seconds to display the big result, after that i have an error message like the attached pictures, is it a ui problem?
regards
Petr Schreiber
30-06-2009, 11:50
Hi Zak,
here it showed the result fast, but then it also GPFed. I am sure Charles will have look, the o2_error does not report any problem in code. What is odd that after that crash run now code runs ok ... it will be some tricky problem.
Lionheart008
30-06-2009, 12:38
hi zak, dear petr...
I have tested the script too, I agree with petr, script is working fine and fast here...
I am at work now,but I send you here a little variable and it works fine for me... perhaps you haven't uploaded the last oxygen dll... that was some of my mistakes the last weeks and month too, if a script doesn't work smooth...
perhaps this one can help:
'ITERATION:
' APPENDING TO STRING
uses "oxygen","file"
dim src as string
src = "
dim i as long
dim s as string
for i=1 to 40
s+=str(i)+chr(13)+chr(10)
s+=str(i)
next
print s
terminate
"
msgbox 0, "test script is working fine here :) "
o2_basic src
if len(o2_error) then
msgbox 0, o2_error : stop
end if
o2_exec
and the second choice you can have to get and see your error messages will be:
if len(o2_error) then
msgbox 0,"ZakTest: "+o2_error+o2_view (src)
file_save("zaktest.txt",o2_view (src))
stop
end if
hope this helps... :) I suggest you haven't the actual oxygen dll ...
you will find it here: http://community.thinbasic.com/index.php?topic=2517.0
best regards, zipped the oxygen dll too, lionheart
Hi Petr , Hi Lionheart008
Lionheart008 you have write:
for i=1 to 40
but the:
for i=1 to 1000
which are producing the error,
i remember the message boxes in another programming languages have a difficulties with displaying a messageBox with a big text also.
regards
Lionheart008
30-06-2009, 14:33
short reply :)
it doesn't matter if you are calculating for i= 40 or i=4000, and the scripts run at my machine even with or without message boxes, I have tried three, four different oxygen script codes ;)
for me the test here was very ok... I have got no error messages ...
don't know why you have this one... but perhaps charles or somebody else can help.. :)
good luck..
best regards, Lionheart
Michael Hartlef
30-06-2009, 16:21
hi zak, dear petr...
I have tested the script too, I agree with petr, script is working fine and fast here...
:roll:
@Franck: before you turn around other peoples words again please read exactly what they wrote :read: .... Petr said the script run fine but THEN a GPF occours.
Hi Zak,
here it showed the result fast, but then it also GPFed.
Clearly he stated that, or? So he confirmed it.
@ZAK, I get the GPF too. And I run the latest beta to my knowledge.
Edit: I might add that I ran it as a console script and the result showed up right away. After I closed the box I got the GPF with a little waiting time.
Lionheart008
30-06-2009, 18:23
short: @mike... I don't like your unfriendly words and behaviour... it's just the second time you are doing this way.. I don't know why... ??? can you please explain it to me??? would be nice... I am sure you can do it better and in a polite way, isn't it ;)
@zak:
a) with my notebook I have got no problems at all... see my first post and reply to you... with the oxygen script...don't know why this script worked fine... without any gpf ;)
b) some minutes before I have tested the script again... with my desktop pc I have got with higher numbers error messages too... and I have tested numbers for i = 1 to 500 and i = 1 to 1800... as this example shows...
the general protection fault windows belongs in my case to...
"modName: ntdll.dll"
so probably it seems to be a bug ;)
best regards, Lionheart
Michael Hartlef
30-06-2009, 21:14
Anyway, it seems you don't like that I just displayed that you talked bull in your first topic and then made ZAK look like it is his own stupid fault. Even after he backed it up. :roll: And what's so unfriendly there? That I quoted what Petr said, so might read it correctly this time? Or the hammer thingy. Pleeeeaaaaase give me a break.
But to make you feel better, I took the hammer away.
And second time? Where?
Lionheart008
30-06-2009, 23:06
hi michael... what's going on here with you ?
btw: the hammer I like at nearly every time :)
don't like that I just displayed that you talked bull in your first topic
why ? my notebook tested the oxygen script first of all as ok... haven't done any mistake... and tested it the second time with my pc and then I have got the mistake too... I wanted to help... that's why I have replied to this topic... not to blame or teach any person like you are doing (so I am feeling now), what's your intention to do in this way??? I cannot understand you and can't follow you... what I can make interpretation for me in this case... is just another thing and doesn't belongs to this topic...
then made ZAK look like it is his own stupid fault
why you are talking for other guys here (petr, zak)... ??? what's your aim ?
do you are feeling satisfied to show anybody's mistakes or say it's bull ??? that's the speech I don't like here... if you are feeling strong with this kind of words, it's ok perhaps for you... not for me... but then I am here not at the right place...
I don't like unpolite words or persons they are acting like this one... and don't support anymore this lower level of conversation that's all...
and I don't give you any break... does it makes sense ? ;) I stop this topic and my post here...
lionheart
Charles Pegge
01-07-2009, 19:30
Hi Everybody,
Sorry to cause controversy - its a hot day for an argument, and I must confess I have not been following this topic.
I've run a series of tests to pinpoint the problem - it appears to be global garbage collection. If zak's string concatenation is run inside a function then all is well for at least 10,000 iterations. Beyond this you will get a conspicuous speed hit, but no crash. The garbage collector is performing his duties correctly, at the end of the function in this case.
As it is fairly deep seated, this may take a while to trace through but I will post the correction as soon as possible.
Charles
uses "oxygen"
'-----------------------
'
'=======================
dim src as string
src = "
#basic
'
function f() as string
dim i
dim as string s
for i=1 to 10000
s=s+str i
next
putfile `t.txt`,s
function=left s,1000
end function
dim as string t=f
print `ok ` t str len t
terminate
"
o2_basic src
if len(o2_error) then
msgbox 0, o2_error() : stop
end if
o2_exec ' TO TEST THE PROGRAM
Charles Pegge
06-07-2009, 21:06
The rain is falling and the heat and humidity have dropped - and as the brain is now working operating within its normal temperature range, the offending bug in the garbage collected has been caught. - Global strings should now be collected correctly at the end of the program.
Charles
http://community.thinbasic.com/index.php?topic=2517.0