Re: Memory usage
From: maark (maark_at_discussions.microsoft.com)
Date: 03/03/05
- Next message: Alex Feinman [MVP]: "Re: Memory usage"
- Previous message: Tris: "Forms - Menu Tree Problems"
- In reply to: Daniel Moth: "Re: Memory usage"
- Next in thread: Daniel Moth: "Re: Memory usage"
- Reply: Daniel Moth: "Re: Memory usage"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 3 Mar 2005 11:11:09 -0800
If static variables are not allocated on the heap in .NET CF - where are
they stored.
"Daniel Moth" wrote:
> That is my understanding too. It basically creates a new Color object which
> since it is a valuetype is simply assigning some variables (based on a bunch
> of conditions, some shifting etc) so there is no heap allocations.
>
> That doesn't change the recommendation to go with the first approach though
> does it?
>
> Cheers
> Daniel
> --
> http://www.danielmoth.com/Blog/
>
>
> "Alex Feinman [MVP]" <public_news@alexfeinman.com> wrote in message
> news:ORbt4DCIFHA.3196@TK2MSFTNGP15.phx.gbl...
> > But color is a value type...
> > Woudn't the only difference be in a few lines of IL that stuff the RGB
> > values in the Color fields?
> >
> > --
> > Alex Feinman
> > ---
> > Visit http://www.opennetcf.org
> > "Daniel Moth" <dmoth74@hotmail.com> wrote in message
> > news:OFOHkiBIFHA.3444@TK2MSFTNGP10.phx.gbl...
> >> Those two are different.
> >>
> >> The first one creates a color and returns *it* everytime you ask.
> >> The second creates a new color *every* time you ask
> >>
> >> Go with the first one.
> >>
> >> Cheers
> >> Daniel
> >> --
> >> http://www.danielmoth.com/Blog/
> >>
> >>
> >> "maark" <maark@discussions.microsoft.com> wrote in message
> >> news:E99A8856-BF0A-47EC-9867-CD921EE2FB9D@microsoft.com...
> >>> Platform: WinCE 4.2, C#
> >>>
> >>> Newbie question:
> >>> Is there any difference in memory footprint between the 2 following
> >>> declarations:
> >>>
> >>> public static Color FG_COLOR = Color.FromArgb(100,100,30);
> >>>
> >>> public static Color FgColor
> >>> {
> >>> get {return Color.FromArgb(100,100,30);}
> >>> }
> >>>
> >>> TIA,
> >>>
> >>> Mark
> >>>
> >>>
> >>
> >
>
>
- Next message: Alex Feinman [MVP]: "Re: Memory usage"
- Previous message: Tris: "Forms - Menu Tree Problems"
- In reply to: Daniel Moth: "Re: Memory usage"
- Next in thread: Daniel Moth: "Re: Memory usage"
- Reply: Daniel Moth: "Re: Memory usage"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|