hw_TrackedAlloc -- allocate memory buffer with tracking (V5.0)
APTR buf = hw_TrackedAlloc(int size, ULONG flags, STRPTR name);
The debug version of Hollywood supports memory tracking to make it easier to detect memory leaks and illegal free memory calls. If you are developing your plugin using a debug version of Hollywood, you can use hw_TrackedAlloc() to allocate a memory buffer that gets tracked by Hollywood. If you forget to free this memory buffer, Hollywood will issue a warning before it terminates. In order to be able to identify the memory buffer that hasn't been freed, you need to provide a name for every memory buffer you allocate using hw_TrackedAlloc(). In case you forget to free a buffer, Hollywood will tell you its name so that you can identify where in your code the allocation was made.

The following flags are currently supported by hw_TrackedAlloc():

If this flag is set, hw_TrackedAlloc() will clear the memory buffer with zeros before returning control to your plugin.

In release versions of Hollywood this function does the same as malloc().

You need to use hw_TrackedFree() to free memory allocated by hw_TrackedAlloc().

This function is thread-safe.

Designer compatibility
Supported since Designer 4.0

size of the buffer in bytes
combination of allocation flags (see above)
null-terminated string containing a name for this buffer; it need not be unique but should help you to identify the allocation; this must always be provided!
pointer to newly allocated memory or NULL on error

Show TOC