Memory Leak In WP8 pages - c#

I have created a sample app in which there are two pages.
1st page contains button, on tapping it takes to second page. In second page there is a list of 100 elements.
In this sample I have navigated to and fro from this second page.
So why is this memory increasing and why is not going down completely on going back to first page and why page destructor never gets called?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Windows.Media.Imaging;
using System.IO;
using System.Diagnostics;
namespace PhoneApp1
{
public partial class Page1 : PhoneApplicationPage
{
public Page1()
{
InitializeComponent();
for (int i = 0; i < 100; i++)
{
listBitmapImage.Add(new Test(i));
}
}
List<Test> listBitmapImage = new List<Test>();
protected override void OnRemovedFromJournal(JournalEntryRemovedEventArgs e)
{
base.OnRemovedFromJournal(e);
}
~Page1()
{
Debug.WriteLine("IN DESTRUCTOR");
}
}
public class Test
{
int _a;
string img = "iVBORw0KGgoAAAANSUhEUgAAALEAAACzCAMAAADxPw38AAADAFBMVEXCwsI9P0DGxsYiIVQiIVUjIlje39/W1tbQ0NDPz8+Wl5jLy8tQUVWPkJEiIVeCg4Pf4ODW1tYkI1kkI1mJiouDhYW5urri4uLY2dnX19ckJFEwMjKen5+6u7uoqKiCg4O+v7/b3NwrLEeur6+xsbKcnZ2+v784OUDj4+PY2Njg4eHf4ODGx8c0NEmoqanR0dLMzMw5OkNhYmK6u7vc3d3T09TQ0NHc3d0MDg8GCQkjIlfh4eF9fn/BwsKQkZLi4uJcXl7V1dUSFBQGCQkFBwgFCAkHCQkEBwcFBwgGCAkGCAkFCAoGCAoGCAgEBwcGCAoQEhIGCAkFCAk9PkAAAAC+tq4qKkKDa1T6xL2KZkSae3H70875vLXTtZbCzM76/P37ysTJnmwTDwq2gUrSr4f5sqmXVCOuuLrYupq+i07w5NWRWiPiy7Ovdjz06+Hcwabi7vEUFhaAfHnq2cb38eqRk5TKoH9RNxnX4+YbHB3519xtb3DAkF8hIyRRSkY3MSwvIBGoqKlfYGC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dOQAKpNpfGhGntcVw3/h2MtZGPbEMK09aQaIvDuuBs0gxQjnqUlU+fdprVPjCFvU5QhoiCypwBcHtNSZigDzXZPW/L04nmvvtDNpKdWbK9sMUQlRRlaituUq1b4CHEzaESJaa3p5zVx1XLCnJZkeXc06GSuJ7Sp4AzD0hdgnzEKHyXLSb8OH+TFV9ivqxhZYvpdf36+Hou6SZC4Xm+y/JrbOggFE8TQphII5H6uy8Hf7u4DRNS33SZIyFeCjDgxe8pC7OcxZdEMy5CsnDGRL8dcdHf3RXNwfm3KBOrfB0XMfgmkj7fHnIXzVj09fcmo6asWjfGAk4IK9htcPBcufmnVXLdXvE3fovfgv7nSH86ziCVwHIjng82PL+JeeDihw/fj+fGFYvzXD75fwTnPIpDJsclkAoW1dmQyGd2AfeDfXDnC9r8dks5B15XK3QAAAABJRU5ErkJggg==";
string img_1, img_2, img3, img4;
public Test(int a)
{
_a = a;
img = a + img;
img_1 = a + "1" + img;
img_2 = a + "2" + img;
img3 = a + "3" + img;
img4 = a + "4" + img;
Debug.WriteLine("CONSTRUCTOR:{0}", _a);
}
~Test()
{
Debug.WriteLine("DESTRUCTOR:{0}", _a);
}
}
}
Here's a link to download sample project.

If yo are using BitmapImage, It had memory issue in windows phone 8 already. That may be the reason you are getting memory issue. Please find a similar issue here
Also this link give you more idea about the issue

Related

c#: Random Choose from web and ignore blank lines

I'm fresh in c# forms i have an important question.
I want to make randomly text writer one line from url "list"
Let Me explain, i wanna to get a random line from pastebin, and rename a label with the random line chosed, and ignore blank lines.
This is a error:
Severity Code Description Project File Line Suppression State
Error CS0103 The name 'randomline' does not exist in the current context SNPCorp C:\Users\GhostStru\Desktop\SNP\Tester\Generator.cs 45 Active
i have that code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net.Sockets;
using System.Net.Security;
using System.Threading;
using System.Net.Http;
using System.Web;
using System.Net.WebSockets;
using System.Net;
using System.IO;
namespace Tester
{
public partial class Generator : Form
{
public Generator()
{
InitializeComponent();
}
private void Generator_Load(object sender, EventArgs e)
{
WebClient web = new WebClient();
string text = web.DownloadString("https://pastebin.com/raw/test");
var lines = text.Split(new string[] { "." }, StringSplitOptions.None);
Random rnd = new Random();
int randomLineIndex = rnd.Next(0, lines.Count());
var randomline = lines[randomLineIndex];
}
private void button3_Click(object sender, EventArgs e)
{
label11 = (randomline);
}
}
}
Your question has some things that aren't clear but I'll try with it. First, I define a method to get a random line:
private static string GetRandomLine()
{
using (var web = new WebClient())
{
var html = web.DownloadString("https://pastebin.com/raw/test");
var lines = html.Split(new string[] { "." }, StringSplitOptions.None);
var rnd = new Random();
int index = rnd.Next(0, lines.Length);
return lines[index];
}
}
Then, you can use that method to set Text property of your label. You must set the Text property, not the label variable
private void button3_Click(object sender, EventArgs e)
{
label11.Text = GetRandomLine();
}
The DownloadString is not working for me. Is that the Url? In any case, if you use a lot this method, is interesting save into a variable the HTML and use it some time (one hour... depending of your needs) as a cache instead of make a request each time. WebClient implements IDisposable so you must invoke Dispose after use it or allow to "using" do it automatically.
I'll try to answer your question even though you haven't explained some points clearly.
Create a function to return the random line
In button3_Click event, call a function that will return a random line, then set the text value of button3 to that returned value.
public static string GetRanLine()
{
using (var WC = new WebClient())
{
var Response = WC.DownloadString("https://pastebin.com/raw/test");
var AllLines = Response.Split(new string[] { "."}, StringSplitOptions.None);
var RanLine = AllLines[new Random().Next(0, AllLines.Length - 1)];
return RanLine;
}
}
private void button3_Click(object sender, EventArgs e)
{
label11 = GetRanLine();
}

ArgumentException "parameter is incorrect"

I'm trying to make a code that converts memorystream to a png image, but I'm getting a ArgumentException "parameter is incorrect" error on using(Image img = Image.FromStream(ms)). It doesn't specify it any further so I don't know why I'm getting the error and what am I supposed to do to it.
Also, how do I use the Width parameter with img.Save(filename + ".png", ImageFormat.Png);? I know I can add parameters and it recognizes "Width", but I have no idea how it should be formatted so visual studio would accept it.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Imaging;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
MemoryStream ms = new MemoryStream();
public string filename;
private void button1_Click(object sender, EventArgs e)
{
OpenFile();
}
private void button2_Click(object sender, EventArgs e)
{
ConvertFile();
}
private void OpenFile()
{
OpenFileDialog d = new OpenFileDialog();
if(d.ShowDialog() == DialogResult.OK)
{
filename = d.FileName;
var fs = d.OpenFile();
fs.CopyTo(ms);
}
}
private void ConvertFile()
{
using(Image img = Image.FromStream(ms))
{
img.Save(filename + ".png", ImageFormat.Png);
}
}
}
}
I suspect the problem is with how you're reading the file here:
fs.CopyTo(ms);
You're copying the content of the file into the MemoryStream, but then leaving the MemoryStream positioned at the end of the data rather than the start. You can fix that by adding:
// "Rewind" the memory stream after copying data into it, so it's ready to read.
ms.Position = 0;
You should consider what happens if you click on the buttons multiple times though... and I'd strongly advise you to use a using directive for your FileStream, as currently you're leaving it open.

Beginner Kinect Programming - "'args' does not exsist in the current context"?

Ok so I started writing an app following the how-to-kinect series from Microsoft and everything was going well until I wrote this:
using (InfraredFrame IRFrame = args.FrameReference.AcquiredFrame())
{
}
For some reason it keeps saying args does not exist in the current context and I have no idea why..here is my full code:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Windows.UI.Xaml.Media.Imaging;
using WindowsPreview.Kinect;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace KinectApp1
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
this.Loaded += MainPage_Loaded;
}
/*Getting the Kinect Sensor*/
KinectSensor Sensor;
/*Getting the Infared Reader*/
InfraredFrameReader IRReader;
/*This is IR Data Form*/
ushort[] IRData;
/*Converting the Data (Buffer) */
byte[] IRDataConverted;
/*Writing the Bitmap Image Described in XAML*/
WriteableBitmap IRBitmap;
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
/*Get the sensor in the loaded frame*/
Sensor = KinectSensor.GetDefault();
/*Get the reader from the Source on the Sensor*/
IRReader = Sensor.InfraredFrameSource.OpenReader();
/*Frame Description for the Infrared and see how big they are*/
FrameDescription FD = Sensor.InfraredFrameSource.FrameDescription;
IRData = new ushort[FD.LengthInPixels];
IRDataConverted = new byte[FD.LengthInPixels * 4];
IRBitmap = new WriteableBitmap(FD.Width, FD.Height);
Image.Source = IRBitmap;
/*Start Sensor*/
Sensor.Open();
/*Subscribe to the event off the Reader*/
IRReader.FrameArrived += IRReader_FrameArrived;
}
void IRReader_FrameArrived(InfraredFrameReader sender, InfraredFrameArrivedEventArgs e)
{
using (InfraredFrame IRFrame = args.FrameReference.AcquiredFrame())
{
if (IRFrame != null)
{
IRFrame.CopyFrameDataToArray(IRData);
for (int i = 0; i < IRData.Length; i++)
{
byte intensity = (byte)(IRData[i]>>8);
IRDataConverted[i*4] = intensity;
IRDataConverted[i*4 + 1] = intensity;
IRDataConverted[i*4 + 2] = intensity;
IRDataConverted[i*4 + 3] = 255;
}
IRDataConverted.CopyTo(IRBitmap.PixelBuffer);
IRBitmap.Invalidate();
}
}
}
}
}
Can anyone kindly explain why this has happened? I am pretty confused,
Thanks in Advance.
P.S this is the video I was following:
http://www.microsoft.com/en-us/kinectforwindows/develop/how-to-videos.aspx
Well it's been answered so I'm not sure what else to do apart from answer it:
As Preston Guillot said in the comments:
"There is no variable named args in scope in the IRReader_FrameArrived method. You have a parameter of type InfraredFrameArrivedEventArgs named e that I'm guessing you meant to use"

CSS overwrite not working in WP8

I am just getting started with WP8 development and I have already stumbled into my first problem: I have followed the How to create your first app for Windows Phone tutorial and now I have followed another tutorial to try and overwrite the CSS of the browser. When I run the app, the CSS is not changed and I just see the original web page.
The CSS file is called mobile.css and is found in the Resources folder. Its contents are simply
body {
background-color: blue;
}
and these are its properties:
The (very simple) app code so far is this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using MiniBrowser.Resources;
using System.IO;
using System.Windows.Resources;
namespace MiniBrowser
{
public partial class MainPage : PhoneApplicationPage
{
public MainPage()
{
InitializeComponent();
}
private void Go_Click(object sender, RoutedEventArgs e)
{
string site = URL.Text;
MiniBrowser.Navigate(new Uri(site, UriKind.Absolute));
}
private void BrowserLoadCompleted(object sender, NavigationEventArgs e)
{
ApplyStyleSheet("mobile.css");
VisualStateManager.GoToState(this, "Loaded", true);
}
private void ApplyStyleSheet(string cssFilename)
{
//var sr = Application.GetResourceStream(new Uri(cssFilename, UriKind.Relative));
StreamResourceInfo sr = Application.GetResourceStream(new Uri("/MiniBrowser;component/Resources/mobile.css", UriKind.Relative));
using (var strm = sr.Stream)
using (var reader = new StreamReader(strm))
{
string css = reader.ReadToEnd().Replace("\r", "").Replace("\n", "");
var scriptToRun =
"(function() {" +
" var pa= document.getElementsByTagName('head')[0] ; " +
" var el= document.createElement('style'); " +
" el.type= 'text/css'; " +
" el.media= 'screen'; " +
" el.styleSheet.cssText= '" + css + "'; " +
" pa.appendChild(el); " +
"})();";
MiniBrowser.InvokeScript("eval", scriptToRun);
}
}
}
}
Everything else works: the browser is displayed and correctly loads pages. The only thing is that the mobile.css file seems to be ignored.
Add the css file as Resource:
Use the following piece of code to get the content:
StreamResourceInfo sr = Application.GetResourceStream(new Uri("/YourAppName;component/Resources/Custom.css", UriKind.Relative));

How can I use open hardware monitor source code in c# ? I tried anything doesn't work

I have this code in Form1:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OpenHardwareMonitor.Hardware.HDD;
using OpenHardwareMonitor;
namespace OpenHardwareMonitor
{
public partial class Form1 : Form
{
OpenHardwareMonitor.Hardware.SensorValue sv;
OpenHardwareMonitor.Hardware.ISensor ii;
public Form1()
{
InitializeComponent();
string y = ii.Name;
sv = new Hardware.SensorValue();
DateTime dt = sv.Time;
float t = sv.Value;
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
ii variable is null I don't know how to make an instance for it.
The other two variables in the constructor return 0 nothing. If I'm not using the ii variable the other two don't throw an error but don't return any values.
I'm using the openhardwaremonitor dll from http://code.google.com/p/open-hardware-monitor/downloads/detail?name=openhardwaremonitor-v0.4.0-beta.zip&can=2&q=
The c# dll is coming with the program it self.
So I added as reference the dll but I don't know how to make the code.
Could someone build for me just an example of the code according to my code here ?
I tried to look in the openhwardwaremonitor site and source code there and didn't understand how to use it.
What else can I do ?
Thanks.
I've tested this code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OpenHardwareMonitor;
using OpenHardwareMonitor.Hardware;
namespace CPUTemperatureMonitor
{
public partial class Form1 : Form
{
Computer thisComputer;
public Form1()
{
InitializeComponent();
thisComputer = new Computer() { CPUEnabled = true };
thisComputer.Open();
}
private void timer1_Tick(object sender, EventArgs e)
{
String temp = "";
foreach (var hardwareItem in thisComputer.Hardware)
{
if (hardwareItem.HardwareType == HardwareType.CPU)
{
hardwareItem.Update();
foreach (IHardware subHardware in hardwareItem.SubHardware)
subHardware.Update();
foreach (var sensor in hardwareItem.Sensors)
{
if (sensor.SensorType == SensorType.Temperature)
{
temp += String.Format("{0} Temperature = {1}\r\n", sensor.Name, sensor.Value.HasValue ? sensor.Value.Value.ToString() : "no value");
}
}
}
}
textBox1.Text = temp;
}
}
}
The form has a multiline text control and a timer. Add a reference to OpenHardwareMonitorLib.dll.
You also need to request a higher execution level in the application, i.e. right click on the project, add a new manifest file item and declare
requestedExecutionLevel level="highestAvailable" uiAccess="false"

Categories

Resources