Now, if we load a skin with a C# plugin and then unload it, you can't delete the plugin from the Plugins folder, citing an error it is still being used by Rainmeter.
Also if a C# plugin is unloaded the memory it uses isn't released. For example if you load PowershellRM plugin by khanhas then memory usage would increase by 15mb or so, but when you unload the skin using it the memory usage stays the same.
I don't know much about PowershellRM but if you make an example plugin say:
Code: Select all
using System;
using System.Runtime.InteropServices;
using Rainmeter;
namespace PluginEmpty
{
class Measure
{
static public implicit operator Measure(IntPtr data)
{
return (Measure)GCHandle.FromIntPtr(data).Target;
}
public IntPtr buffer = IntPtr.Zero;
}
public class Plugin
{
[DllExport]
public static void Initialize(ref IntPtr data, IntPtr rm)
{
data = GCHandle.ToIntPtr(GCHandle.Alloc(new Measure()));
Rainmeter.API api = (Rainmeter.API)rm;
}
[DllExport]
public static void Finalize(IntPtr data)
{
Measure measure = (Measure)data;
if (measure.buffer != IntPtr.Zero)
{
Marshal.FreeHGlobal(measure.buffer);
}
GCHandle.FromIntPtr(data).Free();
}
[DllExport]
public static void Reload(IntPtr data, IntPtr rm, ref double maxValue)
{
Measure measure = (Measure)data;
}
[DllExport]
public static double Update(IntPtr data)
{
Measure measure = (Measure)data;
return 0.0;
}
}
}
Here is an example skin to test this. Clicking on it will take you to plugins folder: