Re: Memory usage

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: maark (maark_at_discussions.microsoft.com)
Date: 03/03/05


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
> >>>
> >>>
> >>
> >
>
>



Relevant Pages

  • heapcreate/heapfree and reserved segments
    ... uncommitted memory available within the address space of the process. ... When we analyze heap utilisation in process dumps from the site we ... an initial 256KB segment is reserved. ... allocations since the amount of VM address space overhead that will be ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Memory is fragmented even though everything is deallocated
    ... I am running Windows XP indeed. ... Plus, if I destroy the process heap, will I be able to allocate on the ... My guess is that deallocated memory is not released by the ... for small allocations only, since the huge chunk of memory allocated ...
    (microsoft.public.vc.language)
  • Re: Memory management terminology
    ... General recomendations could be: ... enable LowFragHeap, if you have reasonably small, same-sized allocations. ... PVOID HashTableAuxiliaryStruct = malloc; ... The above pattern was causing heap exhaustion, ...
    (microsoft.public.vc.language)
  • Re: Basic types: objects or not?
    ... Static variables are stored on a CLR private heap, ... called the "High Frequency" Heap as in Jon's article. ... If we watch the heaps and the stack after the assignment, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Suggestions for my mallocator
    ... many allocations do you allow?), speed vs. memory usage (how much ... A void** is not guaranteed to be able to hold the address of anything ... On first iteration, *r is 0x10000; ... is the number of elements in blocks, not the number of bytes in heap. ...
    (comp.lang.c)