memory_RegisterTypes()

[<<<] [>>>]

This function should be used to initialize the usual FixSizeMemoryObject types. This sets some usual string sizes, but the caller may not call this function and set different size objects.

void memory_RegisterTypes(pMemoryObject pMo
  )@{
This function registers the different string sizes. In the current implementation a string has at least 32 characters. If this is longer that that (including the terminating zchar) then a 64 byte fix size object is allocated. If this is small enough then a 128 byte fix size memory object is allocated and so on up to 1024 bytes. If a string is longer that that then a LARGE_OBJECT_TYPE is allocated.

The reason to register these types is that this memory management module keeps a list for these memory pieces and when a new short string is needed it may be available already without calling malloc. On the other hand when a LARGE_OBJECT_TYPE value is released it is always passed back to the operating system calling free.


[<<<] [>>>]