You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.
with the code below, the alailable memory keep getting lower and lower, i'm suspecting it's because the variables keep Re-Allocating. Is there a chance to get away with it? Thanks~~~
// Toggling a pin in a loop
long last = DateTime.Now.Ticks;
while (true)
{
long now = DateTime.Now.Ticks;
// Toggle every 500ms
if (now > (last + 10000000))
{
last = now;
// Toggle the pin
loopToggledPin_LED2.Write((GpioPinValue)loopPinState);
loopToggledPin_LED4.Write((GpioPinValue)loopPinState);
// Using the C interop here
loopPinState = AddOneInterop(loopPinState) % 2;
DateTime start = DateTime.Now;
//GC.Collect();
//GC.WaitForPendingFinalizers();
DateTime end = DateTime.Now;
char[] content = ("Free Memory:" + mm.AvailableMemory.ToString() + " GC Time:" + (end - start).TotalMilliseconds.ToString() + " ms").ToCharArray();
//BSP_LCD_Clear(0xFFFF00FF);
for (int i = 0; i < content.Length; i++)
{
BSP_LCD_DisplayChar((ushort)(i * 17), 0, content[i]);
}
}
}
The text was updated successfully, but these errors were encountered:
with the code below, the alailable memory keep getting lower and lower, i'm suspecting it's because the variables keep Re-Allocating. Is there a chance to get away with it? Thanks~~~
The text was updated successfully, but these errors were encountered: