[Gambas-user] gb3: multiple errors

Emil Lenngren emil.lenngren at ...626...
Wed Feb 29 14:46:21 CET 2012


Arrange the struct like this to get zero padding (I think):
Data As String
Timestamp As Float
Player As Short
Type As Byte
Acknowledged As Boolean

2012/2/29 Benoît Minisini <gambas at ...1...>

> Le 29/02/2012 07:26, Kevin Fishburne a écrit :
> >>>
> >>> Public Struct Server_QueueOut
> >>>       Acknowledged As Boolean ' Whether or not transaction has been
> >>> acknowledged by recipient.
> >>>       Player As Short         ' Number of player transaction was sent
> to.
> >>>       Timestamp As Float      ' Time transaction was sent.
> >>>       Type As Byte            ' Transaction type.
> >>>       Data As String          ' Transaction payload.
> >>> End Struct
>
> Size of the structure (32 bits) :
> 8 (Gambas object base)
> + 1
> + 1 (padding)
> + 2
> + 4 (padding)
> + 8
> + 1
> + 3 (padding)
> + 4
> = 32 bytes
>
> >>> Public QueueOut[2000, 32768] As Struct Server_QueueOut
>
> 2000 * 32768 * 32 = 2097152000 bytes = 2 Gb.
>
> It's worse on 64 bits because of the padding.
>
> --
> Benoît Minisini
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list