PROCEDURE Main()
local a, c, i
while .t.
a := {}
for i := 1 to 1000000
aAdd( a, { "asdfasdfasdf", 50, 20, 10, {} } )
next
?hb_DateTime(), "before"
c := hb_serialize( a )
?hb_DateTime(), "after - press alt-C for exit"
InKey( 1 )
enddo
return2014-08-27 18:19 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/hbserial.ch
* src/rtl/itemseri.c
+ added HB_SERIALIZE_IGNOREREF flag.
This flag fully disables logic used to detect multireferences to the
same complex (sub)items like arrays or hashes. It increses the speed
of serialization but serialized data does not contain any information
about refences, i.e. aVal[ 1 ] and aVal[ 2 ] in code below:
aSub := { 1, 2, 3 }
aVal := { aSub, aSub }
are serialized as separated arrays. Additionally items with cyclic
references like:
aSub[ 2 ] := aSub
cannot be serialized at all with HB_SERIALIZE_IGNOREREF flag because
it will create infinite serialization loop and crash with out of
memory message.
#include "hbserial.ch"
PROCEDURE Main()
local a, c, i
while .t.
a := {}
for i := 1 to 1000000
aAdd( a, { "asdfasdfasdf", 50, 20, 10, {} } )
next
?hb_DateTime(), "before"
c := hb_serialize( a, HB_SERIALIZE_IGNOREREF )
?hb_DateTime(), "after - press alt-C for exit"
InKey( 1 )
enddo
return
PROCEDURE Main()
local a, c, i
while .t.
a := {}
for i := 1 to 1000000
aAdd( a, { "asdfasdfasdf", 50, 20, 10, {} } )
next
?hb_DateTime(), "before"
c := hb_serialize( a )
?hb_DateTime(), "after - press alt-C for exit"
a := NIL // NOTE This line added
InKey( 1 )
enddo
returnHi Miroslav,
It seems to be related to the internal C function HB_SIZE hb_itemSerialSize() when
checking for cyclic references on the items to be serialized.
For the moment you can use the HB_SERIALIZE_IGNOREREF flag when calling the
HB_Serialize function.
Enter code here...
On Thursday, November 30, 2017 at 6:46:01 AM UTC-6, Miroslav Georgiev wrote:
On 1 Dec 2017, at 17:28, Aleksander Czajczynski <h...@fki.pl> wrote:Thanks all for sharing observations. It seems to me that the app doesn't halt, nor it is infinite loop or corruption.
I think it's something about memory management - OS struggles much more with memmove() operation in subsequent loop.
On a bit older and busy system i can't wait to see the first loop finish. But on a newer machine, HB_Serialize() is blazingly fast first time , yet the second loop is a struggle! a := NIL may help some, but not everywhere.
It seems to be related to the internal C function HB_SIZE hb_itemSerialSize() whenchecking for cyclic references on the items to be serialized.
For the moment you can use the HB_SERIALIZE_IGNOREREF flag when calling theHB_Serialize function.
Enter code here...
On Thursday, November 30, 2017 at 6:46:01 AM UTC-6, Miroslav Georgiev wrote:I have intermittent problems with hb_serialize() when used with little more data than usual.It's hanging (no alt-C) and using 100% CPU
I made sample to demonstrate the problem.It hangs very easily - usually on 1st or 2nd loop.
--
You received this message because you are subscribed to the Google Groups "Harbour Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-deve...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.