Main Site Documentation

Memory full?


#1

The GC on USBizi runs almost every second. Is it because the memory is full.
Is that ok?


Total: (16456 RAM - 165976 ROM - 73949 METADATA)

AssemblyRef = 188 bytes ( 47 elements)
TypeRef = 1508 bytes ( 377 elements)
FieldRef = 216 bytes ( 54 elements)
MethodRef = 2008 bytes ( 502 elements)
TypeDef = 3712 bytes ( 464 elements)
FieldDef = 1888 bytes ( 937 elements)
MethodDef = 4624 bytes ( 2305 elements)

DebuggingInfo = 2332 bytes

Attributes = 48 bytes ( 6 elements)
TypeSpec = 32 bytes ( 8 elements)
Resources Files = 96 bytes ( 4 elements)
Resources = 320 bytes ( 40 elements)
Resources Data = 1196 bytes
Strings = 25575 bytes
Signatures = 10329 bytes
ByteCode = 62659 bytes

01:01:DB:I2C 100 KHZ
01:01:St:Start
GC: 3msec 33180 bytes used, 31200 bytes available
Type 0F (STRING ): 624 bytes
Type 11 (CLASS ): 2388 bytes
Type 12 (VALUETYPE ): 156 bytes
Type 13 (SZARRAY ): 4464 bytes
Type 15 (FREEBLOCK ): 31200 bytes
Type 17 (ASSEMBLY ): 18876 bytes
Type 18 (WEAKCLASS ): 48 bytes
Type 19 (REFLECTION ): 24 bytes
Type 1B (DELEGATE_HEAD ): 648 bytes
Type 1C (DELEGATELIST_HEAD ): 96 bytes
Type 1D (OBJECT_TO_EVENT ): 144 bytes
Type 1E (BINARY_BLOB_HEAD ): 24 bytes
Type 1F (THREAD ): 384 bytes
Type 20 (SUBTHREAD ): 48 bytes
Type 21 (STACK_FRAME ): 1452 bytes
Type 27 (FINALIZER_HEAD ): 144 bytes
Type 31 (IO_PORT ): 180 bytes
Type 33 (I2C_XACTION ): 48 bytes
Type 34 (APPDOMAIN_HEAD ): 72 bytes
Type 36 (APPDOMAIN_ASSEMBLY ): 3360 bytes
01:01:DBF:Start
01:01:DBC:DBRead


#2

Yes it is okay but you should be able to improve your code so it would run less frequent.

Read this please http://wiki.tinyclr.com/index.php?title=Thinking_Small


#3

In my case. 2 to 3 bytes are allocated and freed every time there is a I2C communications.
But there are multiple devices doing it.
So it is a hazzle to allocate global memory statically. To solve this issue.

GC: 3msec 33180 bytes used, 31200 bytes available

Is there a way to make the GC run less often. based on percetage of memory free.
In my case 40% of the memor yis always free


#4

For now I used this

Debug.EnableGCMessages(false);

It looks much better now. But I am not sure even if this is slowing it down


#5

Perhaps you can make a byte array outside the method that is reused. If it’s the same size every time no point in creating it over and over.


#6

This only stops the messages from being displayed. GC is still occurring.

If you have multiple similar devices, then you should look into setting up a class which handles each device. Within each class you could have a separate buffer.