What are the various ways of switching the memory manager in use?

If you want to replace the OSS-provided default memory manager in a space-optimized static library with that of your own or with another OSS memory manager, specify the .obj file corresponding to the desired memory manager on the linker command line before specifying a space-optimized static library (e.g., soeddefa.lib). The following memory manager .obj files can be used:


ossdmgmt.obj -- /MT default plain memory manager
ossfmgmt.obj -- /MT plain memory & file memory manager
osssmgmt.obj -- /MT plain memory, file & TCP/IP socket memory manager

ossdmgmd.obj -- /MD default plain memory manager
ossfmgmd.obj -- /MD plain memory & file memory manager
osssmgmd.obj -- /MD plain memory, file & TCP/IP socket memory manager

Use the following combinations on the linker command line to replace the default memory manager in the static space-optimized library:

ossdmgmt.obj use with soeddefa.lib (already included)
ossfmgmt.obj use with soeddefa.lib 
osssmgmt.obj use with soeddefa.lib

ossdmgmd.obj use with soeddemd.lib (already included)
ossfmgmd.obj use with soeddemd.lib
osssmgmd.obj use with soeddemd.lib

If you want to replace the OSS-provided default memory manager when using the OSS space-optimized runtime DLLs, all you need to do is to rename either ossfmem.dll (plain memory & file memory manager) or osssmem.dll (plain memory, file & socket memory manager) to ossdmem.dll making sure that you do not overwrite the plain memory manager original DLL ossdmem.dll by renaming it to some other name so that later you can restore the original configuration. As a result, your application will load the renamed ossdmem.dll when you call ossinit() or ossWinit().

Alternatively, you may chose to load the memory manager DLL of your choice at run time instead. To do so, you need to call ossLoadMemoryManager() after you call ossinit() or ossWinit(). Do not forget to call ossWterm(), not ossterm(), to free all the OSS resources including the OSS DLLs if you no longer need them.


The samples included with some of the Knowledge Center answers are meant for your general understanding of the OSS products. Different versions of the products might produce slightly different outputs. Consult the products documentation and samples for the most up-to-date products information and code examples.



Contact Support
contact Our office hours
24 hours/day, 7 days/week

  • Phone: 1-888-OSS-2761 (USA and Canada)
  • Phone: 1-732-302-9669 (International)
  • Fax: 1-732-302-0023
  • Email: support@oss.com
Free Trial
download

Test drive the OSS Nokalva ASN.1, LTE, and XML Tools now! Your trial includes complete software, documentation, sample programs, free 24x7 technical support and more.




Learn ASN.1
Learn ASN.1

Our expert personnel can help you learn ASN.1!

We offer 4-day ASN.1 courses at our headquarters or your premises.