public class MainClass
{
static void Main()
{
huffcodetab.inithuff();
}
}
public class huffcodetab
{
private static int[][] ValTab0;
private static int[][] ValTab1;
public static void inithuff()
{
static huffcodetab()
{
}private static int[][] ValTab1;
public static void inithuff()
{
Console.WriteLine("huffcodetab.inithuff called");
}static huffcodetab()
{
ValTab0 = new int[][] {new int[]{12, 1},
// add more of "new int[][]{x,y}" values
// add more of "new int[][]{x,y}" values
}// add more of "new int[][]{x,y}" values
new int[]{4, 1}, new int[]{0, 119}};
ValTab1 = new int[][] {new int[]{12, 1}, // add more of "new int[][]{x,y}" values
new int[]{4, 1}, new int[]{0, 119}};

static constructors in compact framework - size limit?
ekb0211
public class huffcodetab
{
{
{
//the rest of the oversize array
new int[]{2, 1}, new int[]{0, 0}
{
//the rest of the oversize array
new int[]{2, 1}, new int[]{0, 0}
wBob
I've made some progress with this thanks to your link. I've testing this with a CE.NET 4.2 device, as well as the CE and PPC emulator. I've changed the code to have several method calls in the static constructor. (I hope I have the terms right)
static huffcodetab()
{
ValTab2 = ReturnValTab2(); //etc
private static int[][] ReturnValTab1()
{
And the code now works on the CE device, but still dies in the CE and PPC emaulators. They fail with a NotSupportedException, then a managed OutOfMemoryException. (two dialog boxes). It quits when I call the method that returns a int[517][2] sized array. The other arrays that work are all int[127][2]. Have I cross some magic line that works that won't work on the emulators On the CE device, the memory usage only goes from 6.3 MB to 7.4 MB. Is there any way that I could change the way the methods are called to make it more tolerant Thanks guys.
Ken Villines
instantiation of your array into several functions." I tried the following (moving the instantiation of the array into a function), but the results were the same.
The link also mentioned putting all the data in an embedded resource, then reading it in (I assume in the constructor). I can't see how that would be any different - the method that returns the array would just have read, populate and return the array Wouldn't the "jitted code" be identical after the method returns. Anyway - thanks for the link. I'll keep searching. If you have advice, I would welcome it. - dan
public class MainClass
{
static void Main()
{
huffcodetab.inithuff();
}
}
public class huffcodetab
{
private static int[][] ValTab1;
public static void inithuff()
{
static huffcodetab()
{
private static int[][] ReturnValTab1()
{
pingfr2005
No, it wouldn't. Static initialization results in all of the array initialization data becoming the part of the method's code blowing the size limit. Reading the data from an embedded resource does not have this problem
cisco0407
Please see this:
http://groups.google.com/group/microsoft.public.dotnet.framework.compactframework/browse_frm/thread/af3a5c0c28780d65/78149282264e69ab #78149282264e69ab