Skip to content

String Memory Leak #149

@tomspilman

Description

@tomspilman

I noticed this in one of our wrapped functions:

        protected Effect(string name)
        {
            var arg0 = Marshal.StringToHGlobalAnsi(name);
            __Instance = Marshal.AllocHGlobal(88);
            Internal.ctor_0(__Instance, arg0);
        }

Here you use Marshal.StringToHGlobalAnsi to marshal the string to C++, but you don't free the string. From the docs it says that you should be calling Marshal.FreeHGlobal(arg0); to free that memory.

I suspect this is a memory leak in CppSharp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions