Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Why memory keep reducing? #243

Open
weixiongmei opened this issue Mar 2, 2017 · 1 comment
Open

Why memory keep reducing? #243

weixiongmei opened this issue Mar 2, 2017 · 1 comment

Comments

@weixiongmei
Copy link

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]);
                }
            }
        }
@snikeguo
Copy link

snikeguo commented Sep 21, 2017

@weixiongmei 这个项目估计完了....,兄弟,有很多BUG是正常的

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants