Main Site Documentation

Failed allocation


#1

Get the following message:

GC: 3msec 30480 bytes used, 33900 bytes available
Type 0F (STRING ): 888 bytes
Type 11 (CLASS ): 3168 bytes
Type 12 (VALUETYPE ): 540 bytes
Type 13 (SZARRAY ): 2340 bytes
Type 15 (FREEBLOCK ): 33900 bytes
Type 16 (CACHEDBLOCK ): 264 bytes
Type 17 (ASSEMBLY ): 16476 bytes
Type 18 (WEAKCLASS ): 48 bytes
Type 19 (REFLECTION ): 24 bytes
Type 1B (DELEGATE_HEAD ): 324 bytes
Type 1D (OBJECT_TO_EVENT ): 96 bytes
Type 1E (BINARY_BLOB_HEAD ): 2016 bytes
Type 1F (THREAD ): 1152 bytes
Type 20 (SUBTHREAD ): 144 bytes
Type 21 (STACK_FRAME ): 780 bytes
Type 22 (TIMER_HEAD ): 72 bytes
Type 27 (FINALIZER_HEAD ): 144 bytes
Type 31 (IO_PORT ): 108 bytes
Type 34 (APPDOMAIN_HEAD ): 72 bytes
Type 36 (APPDOMAIN_ASSEMBLY ): 1824 bytes
Failed allocation for 343 blocks, 4116 bytes

Failing allocation means I’m out of memory? How do I find out why its failing?


#2

You have enough memory but your heap is fragmented.

Before you allocate large buffer (yeah 4K is large on 62K system!) do this first Debug.GC(true);


#3

Are things like this covered in a normal C# college class?


#4

Is there a NETMF class in college! Maybe in couple years :slight_smile: