ms_malloc 2.0

  1. For C programming.
  2. Can be used in C++ programs, too.
  3. Solve memory leaks.
  4. Prevent memory leaks.
  5. Provide a manual garbage collection for C and C++ programs.

What ms_malloc Is

Is C/C++ source code that you compile into a library or simply compile with your other source code files. ms_malloc is designed to compile with either a C or C++ compiler. The license that you purchase allows you to make some modifications. For example, you can modify the source code so that it compiles with the C or C++ compiler of your choice. ms_malloc amounts to a library of functions to replace the C functions malloc(), calloc(), realloc(), and free(). ms_malloc provides functions to list all allocation sets (more about sets, below), all allocations in a set, and the length of an allocation. The lists returned are arrays. The last element of an array is zero.

What ms_malloc Does

ms_malloc tracks your heap allocations, so you don’t have to. You only track the set number that you specified when you allocate, heap memory. And you can make any number of allocations to a set. You also have functions that report all the allocations you made, and on what allocation set, the size of an allocation, and the like. When you are done with an allocation, you do not free the allocation; instead, you free a set of one or more allocations. Freeing one allocation of a set is possible by moving the allocation to a temporary set, then deleting that set.

How ms_malloc Works

ms_malloc keeps an in-memory database of allocations. Every allocation is associated with a set, the set you specify when you call ms_malloc().

The Advantage of Using ms_malloc

Because allocations are associated with sets, you can dedicate a set to a particular linked-list. Thus all allocations of that linked-list will be on the set. So, when you are done with the linked list, you just deallocate the set. ms_malloc deallocates all the allocations of that set.

If you have a long term in-memory linked list, ms_malloc makes implementing a manual garbage collection easy. As you add and delete nodes, you just forget about nodes you unlink, similar to languages that have built-in garbage collection. Then, from time to time, you do a garbage collection by moving all the still-active nodes to a temporary set. Then delete the list––ms_malloc remembers all the unlinked nodes and deletes them. Then you merge the temporary set back to the original (now empty) linked-list set.

You can use ms_malloc to isolate an existing memory leak by replacing calls to the Standard C library malloc(), calloc(), and realloc() with calls to ms_malloc(). That allows you to dump all allocation sets and dump all allocations to a set at any point in the program. Thus, you can get the information to isolate the memory leak.

Why ms_malloc Works with All Operating Systems

ms_malloc is C source code, and uses only standard C functions. Therefore, it should work on any operating system for which there is a C or C++ compiler. Of course, a C or C++ Compiler is required to use ms_malloc.

Target Customers

ms_malloc is for software developers who code in C or C++ and want a better way to manage heap memory.

Required to Use

To use ms_malloc, you need a compiler for C or C++ code that compiles C99. Since the ms_malloc package is source code, ms_malloc should work in programs for Windows, Mac, Android, iPad, and any embedded operating system for which there is a C compiler.

Key License Features

Number of copies you may make: Unlimited.

Modifications allowed to ms_malloc: Yes

Create derivative work: Yes.

May transfer license: Yes.

Licensees are: Entities. An entity can be an individual, group, company, etc. If a developer leaves a company and both the developer and the company want to continue using ms_malloc, an additional license needs to be purchased. Otherwise, the license can be transferred to either the developer or the company.

Sample License Agreement

Due to oversight, the sample license agreement might not be up-to-date. Otherwise, it is the same license included in the ms_malloc package.

ms_malloc License.pdf