I'm totally new to the world of writing plugins/dll's, so forgive me if I'm missing something totally obvious. I noticed that any plugins I've started writing end up eating away at memory with each plugin function call.
So I wrote the simplest plugin I possibly could, using C#. It contains a single method that does nothing. Calling it continuously in my AppGameKit code causes my program to gradually consume more and more memory without freeing it until I close the program.
C# code:
using System;
using System.Runtime.InteropServices;
using RGiesecke.DllExport;
namespace MemTest
{
public static class Class1
{
[DllExport("ReceiveAGKPtr", CallingConvention = CallingConvention.Cdecl)]
public static void ReceiveAGKPtr()
{
}
[DllExport("VoidMethod", CallingConvention = CallingConvention.Cdecl)]
public static void VoidMethod()
{
}
}
}
AGK code:
#import_plugin TestPlug
// Project: MemTest
// Created: 2017-06-13
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "MemTest" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 0, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
do
for i = 0 to 100 `calling many times to speed up memory consumption
TestPlug.VoidMethod()
next i
print(ScreenFPS())
Sync()
loop
Am I doing something wrong or is this possibly a bug?
-h