user3447279
user3447279

Reputation: 89

Out of memory when starting process from c# and mono

I am working with an embedded linux board (Atmel AT91SAM) with Debian installed. There is a mono application running and its switching an output from GPIO on/off periodicly (like every 500ms) by calling cat by starting a new System Process with bash. After some time I get an "Out of memory" exception and output is not set for a time, after it "recovers itself" after some seconds.

Upvotes: 2

Views: 1523

Answers (1)

SushiHangover
SushiHangover

Reputation: 74184

You can try skipping the Process Class and any memory management/garbage collection associated to it by directly use libc's system.

In your Class that you are defining the OnTimer1Event method, add a definition to system:

   [DllImport ("libc")]
   private static extern int system (string exec);

Then you can:

private void OnTimer1Event(object source, ElapsedEventArgs e)
{
        alternateBlinkTimer1.Stop();
        alternateBlinkTimer2.Start();
        system("echo 1 > /sys/class/gpio/pioC10/value\");
}

Upvotes: 2

Related Questions