J
Jon Brunson
Hi all,
From what I've read each CE app can only use 32Mb of memory, is there
anyway to expand this?
Our App is rather large and demanding, and sometimes the app runs out of
memory, usually while doing Sql-stuff.
I've looked into VirtualAlloc, but firstly I don't /really/ understand
it, and secondly, it seems to makes no difference in our App.
Below is an app I whipped up to test memory usage. On my device it runs
39 times, then throws an out of memory exception both with, and without
the VirtualAlloc code commented-out.
[VB.NET]
Public Class Form1
Inherits System.Windows.Forms.Form
Public Shared Sub Main()
Application.Run(New Form1)
End Sub
<System.Runtime.InteropServices.DllImport("coredll")> _
Private Function VirtualAlloc(ByVal lpStartAddr As IntPtr, ByVal size
As Integer, ByVal flAllocationType As Integer, ByVal flProtect As
Integer) As IntPtr
End Function
<System.Runtime.InteropServices.DllImport("coredll")> _
Private Function GetLastError() As Integer
End Function
Private MEM_RESERVE As Integer = &H2000
Private MEM_COMMIT As Integer = &H1000
Private PAGE_READWRITE As Integer = &H4
Private PAGE_NOACCESS As Integer = &H1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.Visible = True
Application.DoEvents()
Dim offset As Integer = 1
'Dim x As IntPtr = Me.VirtualAlloc(Nothing, 2 * 1024 * 1024,
MEM_COMMIT Or MEM_RESERVE, PAGE_READWRITE)
'If x.ToString() = "0" Then
' MessageBox.Show(Me.GetLastError().ToString())
'End If
Try
While True
Dim p As New PictureBox
p.Bounds = New Rectangle(offset * 8, offset * 8, 25, 25)
p.Image = New Bitmap(500, 700)
Me.Text = offset
offset += 1
Application.DoEvents()
End While
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub
End Class
[/VB.NET]
Thanks for reading, and I hope someone is able to help/advise me
From what I've read each CE app can only use 32Mb of memory, is there
anyway to expand this?
Our App is rather large and demanding, and sometimes the app runs out of
memory, usually while doing Sql-stuff.
I've looked into VirtualAlloc, but firstly I don't /really/ understand
it, and secondly, it seems to makes no difference in our App.
Below is an app I whipped up to test memory usage. On my device it runs
39 times, then throws an out of memory exception both with, and without
the VirtualAlloc code commented-out.
[VB.NET]
Public Class Form1
Inherits System.Windows.Forms.Form
Public Shared Sub Main()
Application.Run(New Form1)
End Sub
<System.Runtime.InteropServices.DllImport("coredll")> _
Private Function VirtualAlloc(ByVal lpStartAddr As IntPtr, ByVal size
As Integer, ByVal flAllocationType As Integer, ByVal flProtect As
Integer) As IntPtr
End Function
<System.Runtime.InteropServices.DllImport("coredll")> _
Private Function GetLastError() As Integer
End Function
Private MEM_RESERVE As Integer = &H2000
Private MEM_COMMIT As Integer = &H1000
Private PAGE_READWRITE As Integer = &H4
Private PAGE_NOACCESS As Integer = &H1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.Visible = True
Application.DoEvents()
Dim offset As Integer = 1
'Dim x As IntPtr = Me.VirtualAlloc(Nothing, 2 * 1024 * 1024,
MEM_COMMIT Or MEM_RESERVE, PAGE_READWRITE)
'If x.ToString() = "0" Then
' MessageBox.Show(Me.GetLastError().ToString())
'End If
Try
While True
Dim p As New PictureBox
p.Bounds = New Rectangle(offset * 8, offset * 8, 25, 25)
p.Image = New Bitmap(500, 700)
Me.Text = offset
offset += 1
Application.DoEvents()
End While
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub
End Class
[/VB.NET]
Thanks for reading, and I hope someone is able to help/advise me