« first day (2882 days earlier)      last day (898 days later) » 

11:28 AM
@HostileFork do you think if it is safe to have 2 REBVALs sharing 1 REBSER, just with different indexes?
It works ok until I don't need to extend the series. :-/
 
 
4 hours later…
3:13 PM
@Oldes Hm? What do you mean? That's the way REBVALs work today. It's not particularly robust when you have something like an index at 1000 in one value, and then you clear the series through another, but that's just been how Rebol is; every access has to check to see if the index is no longer in range and not crash
 
Yes... I though so... must be some other issue in my code.
 
 
1 hour later…
4:35 PM
Of course it is my issue... just noticed that my series' rest value is lower than tail... grrr.
 
 
2 hours later…
6:52 PM
@HostileFork when using series to hold pure binary data, do I need to count with the terminator? I quite don't get, how the series expansion works in R3. Looks like when I have series with size like 300 bytes and need to be able hold it exactly 1024 bytes, when I use number 1024, the result is 3072 bytes allocated internally. When I use 1023, result is 2048 bytes.
I understand it is preallocating more so it would not need to move data later, but in my case I'm quite sure it will not need to expand soon.
And my issue above was related... I knew that I have let's say 512 size series and needed like 1024 bytes, so I used Expand_Series(bin, AT_TAIL, 512); but correctly it is 1024.
 
@Oldes If an allocation comes from pooled memory, you will end up with an allocation the size of the units in that pool. If your allocation is larger than will fit in a pool, then it will fall back on malloc(). There is a powerof2 allocation flag in R3-Alpha's Make_Series which will round things up to a power of 2.
R3-Alpha wasn't totally obvious about the terminator, or why it would be that a binary would need a terminator.
But generally, it seemed that it was required. Ren-C enforces it. One benefit of enforcing it is that aliasing a UTF-8 BINARY! as a string is possible, as it is expected by the APIs that strings will be terminated.
So it is not surprising that you ask for 1024, it puts on the terminator so now you're at 1025, so you'll need a larger pool than the 1024 pool.
Kind of annoying.
 
Ok. Thanks for your opinion.
Still think, that the original documentation for Expand_Series is confusing if not wrong.
 
@Oldes There's some twisty code. Ren-C still has a lot of it just hanging around; but has a lot of cleverness in things like the series allocator. Rather nifty.
 
 
4 hours later…
10:37 PM
@HostileFork do I understand it well that you removed this strange part of code? -> github.com/Oldes/Rebol3/blob/master/src/core/…
Because it looks it is the part which is wrong in my case.
This is what I see in traces:
BIN Series #02E39390 "-": wide: 1 size: 4096 bias: 0 tail: 0 rest: 4096 flags: #00004001
02EA8320: 00 .
index: 0 tail: 0 len: 9682 tail_new: 9682 rest: 4096
expanding by delta: 5586
BIN Series #02E39390 "-": wide: 1 size: 8192 bias: 0 tail: 5586 rest: 8192 flags: #00004001
So when I have series with 4096 bytes size and need series to hold 9682 bytes... the delta is 5586, but resulted size is only 8192 bytes.
And it looks the strange code from the link is the reason.
Or the 3. parameter of the Expand_Series is not delta but required new series tail.
 
11:01 PM
Hm.... I understand now... it is delta, but counted from tail and not rest as I was doying.
But it is strange, because if I know that my new tail fits into the rest of the available space, I don't have to call Expand_Series at all.
 
11:25 PM
Never mind... problem solved.. I'm not going to rewrite everything:)
 

« first day (2882 days earlier)      last day (898 days later) »