Memory Allocation On The Heap For Reference Type

  • Thread starter Thread starter One Handed Man [ OHM# ]
  • Start date Start date
O

One Handed Man [ OHM# ]

I want to declare the following

Dim BoolGrid(511,511) as Boolean

and

Dim Bitgrid As New BitArray(511*511)


How can I find out the size of memory allocated on the heap for each one ?
 
Well, the question was more on a general basis actually. For example, if my class contained 50 private value types of different ones like integer, double, float etc. How could I find out what the memory taken up my the actual object is on the heap.

Regards


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com

Now I answer to you LOL

Boolean variables are stored as 16-bit (2-byte) numbers

BitArray need 1 byte for each 8 values

So I guess a bitArray(16) that hold 16 values is as large as 1 boolean.

Am I right?

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot}com> wrote in message I want to declare the following

Dim BoolGrid(511,511) as Boolean

and

Dim Bitgrid As New BitArray(511*511)


How can I find out the size of memory allocated on the heap for each one ?
 
I dont know what you find funny about my question. It is perfectly reasonable.

--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com

I dont suggest to add each fied's requirement...
LOL

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot}com> wrote in message Well, the question was more on a general basis actually. For example, if my class contained 50 private value types of different ones like integer, double, float etc. How could I find out what the memory taken up my the actual object is on the heap.

Regards


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com

Now I answer to you LOL

Boolean variables are stored as 16-bit (2-byte) numbers

BitArray need 1 byte for each 8 values

So I guess a bitArray(16) that hold 16 values is as large as 1 boolean.

Am I right?

--
Cheers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot}com> wrote in message I want to declare the following

Dim BoolGrid(511,511) as Boolean

and

Dim Bitgrid As New BitArray(511*511)


How can I find out the size of memory allocated on the heap for each one ?
 
Even so, a BitArray require a byte of memory for 8 boolean values so I guess
is better to use BitArray for lots of related booleans like my case is
 
Back
Top