r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[RAMBO] The REBOL bug and enhancement database

Maxim
15-Jan-2007
[2448x2]
row/column of values with equivalent outputs in all other types.
Ladislav, why is the str/a corrupted after a recycle?
Ladislav
15-Jan-2007
[2450x2]
my interpretation: a is relocated to be able to grow and STR does 
not "protect" the old memory while still referencing it
I guess I should put it to RAMBO, because it is not covered by the 
STRUCT! documentation
Maxim
15-Jan-2007
[2452]
ybut the size is within the 15 bytes you asked at a's outset no?
Ladislav
15-Jan-2007
[2453x2]
yes, that is another issue - due to an INSERT quirk you need to allocate 
17 places to make sure 15 elements fit in
(already in RAMBO)
Maxim
15-Jan-2007
[2455x2]
and in any case, the reduced "a" is separate (copied) and in ram 
is probably equivalent to a: make string! 1...  so I guess the real 
bug is that structures do not properly identify regions of ram they 
point to.
<shudders> in my spine... if this is the case !
Ladislav
15-Jan-2007
[2457x2]
reduced "a" is not copied...
you can make sure by inserting less elements (say 2)
Maxim
15-Jan-2007
[2459x2]
I have written 4 replies to the above, and everytime, I remember 
another detail about struct which is not obvious... and in all cases, 
I come back to this being a GC bug IMHO.
(replies I never sent... since they didn't identify another possibility 
when the sentence was finished)
Ladislav
15-Jan-2007
[2461]
aha :-)
Maxim
15-Jan-2007
[2462x2]
(and you are right, the reduced "a" is not copied. if you change 
the first letter, then str/a is also changed)
I looked quickly at the code... and tought I'd seen rejoin somewhere 
;-)
Gabriele
15-Jan-2007
[2464]
i think it should be considered a bug, the old string should probably 
not be GCed or there should be some way to tell struct! what to do. 
(wasn't there a "save" attribute for structs?)
Joe
15-Jan-2007
[2465x2]
resize-image: func [
	dest [file!]
	size [pair!]
	file [file!]
	/local im
][	
	im:		load-image file
	save/png 	dest to-image layout [origin 0x0 image (im) (size)]
	im:		none
]
this leaks on 1.3.2.4.2  Is it a bug ?
Maxim
15-Jan-2007
[2467x2]
the GC does not imediately recycle memory.
does this grow to hundreds of MB of RAM if you do this in a loop?
Ladislav
15-Jan-2007
[2469]
right, Gabriele, the save attribute is mentioned in http://www.rebol.com/docs/library.html#Garbage
, but it doesn't look like related to this situation
Gabriele
15-Jan-2007
[2470]
we may need a new attribute... i wonder what happens if you set the 
pointer manually though. either way you might get bugs. (though, 
your example is more common than setting the pointer manually, so 
i'd prefer to have that fixed.) we can also just state, that this 
is a documentation problem, and that the programmer should take care 
of keeping the string valid (it's for C interfacing after all, although 
we use structs for other things too)
Volker
15-Jan-2007
[2471]
We need an explicit malloc/free IMHO. maybe with copying the string. 
How  about  a little dll for such stuff?
Ladislav
16-Jan-2007
[2472]
(I added the [save] attribute note to RAMBO too)
Joe
16-Jan-2007
[2473]
Maxim, yes !
Maxim
16-Jan-2007
[2474]
does replacing this:

dest to-image layout [origin 0x0 image (im) (size)]

by this:

dest to-image layout [origin 0x0 image im size]

do anything?
Anton
17-Jan-2007
[2475]
Yes, in the first case, the words IM and SIZE are sure to be evaluated 
outside the layout dialect, whereas in the second case, there is 
a fear that they might be interpreted as dialect words. They could 
be interpreted as dialect words if you added an IM style earlier 
and forgot about it, or the layout dialect was extended with an IM 
word and you didn't notice. In your little example, I see no difference, 
except that the first example could survive changes to the layout 
dialect better. I don't think the layout dialect will change much 
(in View 2.x  versions anyway).  I've been tending to write variables 
in parens, so I need to worry less about the possibility of misinterpretation.
Anton
18-Jan-2007
[2476x4]
Hmm. If I do this several times then memory is quickly exhausted:
view layout [area mold system]
I observe this slowing down and GROW-FACETS is slowly molding larger 
and larger.
repeat n 1000 [layout [area (s: mold get in svv 'grow-facets)] print 
[n length? s]]
Ladislav
18-Jan-2007
[2480]
Only now I noticed:
>> -2147483647  + -2147483648
** Math Error: Math or number overflow
** Near: -2147483647 + -2147483648
>> -2147483648  + -2147483648
== 0
Anton
18-Jan-2007
[2481]
I think the second one should also produce an overflow error, since 
a correct result is too large for an integer!
Ladislav
18-Jan-2007
[2482x2]
#3520 seems to work OK now (rebol/version == 1.3.2.3.1), so we should 
mark it as solved, shouldn't we?
aha, the add issue above is already in RAMBO as #3839 (by Jaime)
Volker
18-Jan-2007
[2484]
view layout [area mold system]

the text would include this  area the  next time, then include a 
text  which inlcudes the lastlast text and so on?
Ladislav
18-Jan-2007
[2485x2]
regarding #3520 once again:

to integer! -2147483647.9 ; == -2147483648
to integer! -2147483648 ; == -2147483648
to integer! -2147483648.1
** Math Error: Math or number overflow
** Near: to integer! -2147483648.1
sorry, to integer! -2147483647.9 ; == -2147483647
Gabriele
18-Jan-2007
[2487]
ladislav: yes, please mark it as built. (i think we could mark it 
as tested too, if everyone agrees)
Ladislav
18-Jan-2007
[2488x2]
and, Gabriele, what do you think about the to integer! -2147483648.1 
issue? (it may be related!)
...if I evaluate an expression supposed to yield -2147483648.0 but 
obtain a "slightly different" result, then the conversion may still 
not be possible due to the fact, that the overflow is a bit "premature" 
in this case, because -2147483648.1 actually *can* be converted to 
-2147483648 without any overflow
Maxim
18-Jan-2007
[2490]
but because it cannot stored in a loaded block, should we allow it 
anyways?
Ladislav
18-Jan-2007
[2491x2]
do not understand your question
can you be more verbose?
Maxim
18-Jan-2007
[2493x2]
hum... I didnt' think -2147483648  was a valid int value... sorry.
but it seems to be.
Ladislav
18-Jan-2007
[2495]
aha, now it makes sense to me
Maxim
18-Jan-2007
[2496x2]
>> -2147483648  + -2147483648
== 0

this is a bad bug!
I understand the complement and the reason why this is returned (cause 
I've done C before...) but ask any novice and he'll just say this 
is nonsense!