Re: Framework 2.0 array redim unsatisfactory performance



Tom,
| Process.GetCurrentProcess().WorkingSet64
WorkingSet64 is the Working Set or total amount of physical memory in use,
this is by no means the amount of memory the GC has allocated. In other
words it includes objects that have not yet been garbage collected, plus it
includes the space for objects that were previously allocated but have
already been collected.

As I stated, the GC over allocates physical memory as needed & will only
return it when the OS requests it as another app is asking for more
memory... In other words the Working Set includes both allocated memory &
free memory. You need to use the .NET performance counters or CLR Profiler
to see how much memory is currently allocated.

| What I am looking for is dynamic data structure which has the least memory
| overhead.
That would be List(Of T) with the "capacity" constructor set to the expected
number of elements. For example if you know there are going to be 50 to 75
elements in the list, but no more then 100. I would pass 50 or 75 to the
constructor. With 50, there would be at most a single reallocation.

If your not sure what the limit is going to be, but once the list is filled
its "constant", the I would recommend using List(Of T).TrimExcess when I
finished filling the list.

http://msdn2.microsoft.com/library/ms132207(en-us,vs.80).aspx

Hope this helps
Jay

"Tom Jastrzebski" <tom@xxxxxxx> wrote in message
news:qNxKe.68$UA1.27@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
| Jay,
|
| I just noticed something I thought was interesting and decided to write
| about it, thinking that someone migrating from VB 6.0 may experience this
| issue, regardless of what the root cause is and whether these environments
| should be compared or not.
|
| As I said, the only reason why I tried "array redim" was because I was
| hoping to be nicely surprised - and I was not.
|
| What I am looking for is dynamic data structure which has the least memory
| overhead.
| It seems like at some point I will have to develop my own. But that is OK,
| it by no means diminish the value of .Net Framework.
|
| To check process memory utilization I use:
| Process.GetCurrentProcess().WorkingSet64
|
| Peace,
| Tomasz
|
|


.



Relevant Pages

  • Re: Still confused why working set larger than virtual memory
    ... The next time I map the same part of the file, it still contains the same data I filled it before, demonstrating it resided somewhere (I also explained why I am sure they resided in the physical memory, not in the page file). ... This also exactly what Alexander Nickolov is talking about: even when you unmap your file views, the pages still may reside in the memory and may be a part of the working set. ... I am not freeing the memory, I am only unmapping its virtual addresses. ...
    (microsoft.public.vc.language)
  • Re: Still confused why working set larger than virtual memory
    ... > physical memory and counts as a part of the working set of current process ... I do not know what definition of working set which OS uses when reporting this value. ... If you want to prove this, you should be able to construct a simple code using VirtualQuery or VirtualAlloc, or by monitoring the global virtual space usage using GlobalMemoryStatus - and no, I have no intention to construct such code for you. ... I think you guys mean when we unmap some pages, since they are still in the physical memory and counts as a part of the working set of current process and at the same time they do not have virtual address, so we can see working set is larger than virtual bytes. ...
    (microsoft.public.vc.language)
  • Re: Still confused why working set larger than virtual memory
    ... has virtual address, and when we unmap it, it does not have virtual memory ... but it resides in memory. ... working set shirnks to very little value. ... MB of physical memory and using no virtual addresses, ...
    (microsoft.public.vc.language)
  • Re: Framework 2.0 array redim unsatisfactory performance
    ... implementation details of Redim, Redim Preserve, and List. ... significantly higher object allocated overhead then List. ... ReDim simply allocates a new ... but I do not even attempt to test its memory ...
    (microsoft.public.dotnet.languages.vb)
  • Re: CE6.0 Driver Pointer Marshalling - passing pointers out only?
    ... This is an array of pointers to buffers that get set up ... the driver allocates the buffers (via an internal allocation ... routine from its own block of reserved memory). ... So I can map ...
    (microsoft.public.windowsce.platbuilder)

Loading