James,
Was there something wrong with the replies you got in the VB
newsgroup?
>I need help with a couple of questions, I have create and structure like:
>Structure byteArray
[quoted text clipped - 3 lines]
>
>Public ptrArray() As byteArray
I don't see the need for the strucure. Why don't you just do
Public ptrArray()() As Byte
>1) It seems that an structure increase the memory usage (I suppose it create
>internal variables).
No the structure doesn't add any additional overhead. But each array
object does, it needs to keep track of its size for example.
Mattias

Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
James - 09 Dec 2005 07:16 GMT
Thanks Mattias for your answer.
I think that using Public ptrArray()() As Byte, I can not dinamically change
both dimensions, that is I need something like:
ptrArray(1)(200) -> 200 bytes array
ptrArray(2)(20) -> 20 bytes array
ptrArray(3)(100) -> 100 bytes array
Is that possible?.
One of my questions was: How can I know the memory usage of a variable,
class, array, ... in VB.NET, that is is there a command like SIZEOF in C?
(somebody suggested to post this question here).
Thanks,
James
> James,
>
[quoted text clipped - 21 lines]
>
> Mattias
Mattias Sjögren - 10 Dec 2005 11:16 GMT
>that is I need something like:
>
[quoted text clipped - 3 lines]
>
>Is that possible?.
Yes
>One of my questions was: How can I know the memory usage of a variable,
>class, array, ... in VB.NET, that is is there a command like SIZEOF in C?
>(somebody suggested to post this question here).
No there's no sizeof operator. The size is not available from managed
code. You can get the information from a profiler or debugger if you
really want to know.
Generally for arrays the size is the element size times the number of
elements, plus a small fixed overhead for the array descriptor.
Mattias

Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.