Click here to Skip to main content
15,895,667 members
Home / Discussions / C#
   

C#

 
Questionoverriding Pin
angels77717-May-08 3:09
angels77717-May-08 3:09 
AnswerRe: overriding [modified] Pin
Anthony Mushrow17-May-08 7:12
professionalAnthony Mushrow17-May-08 7:12 
QuestionRunninng a clickonce deployed app from VBA Pin
rotsey17-May-08 3:08
rotsey17-May-08 3:08 
Questionwhy we need registry ? Pin
prasadbuddhika17-May-08 3:05
prasadbuddhika17-May-08 3:05 
AnswerRe: why we need registry ? Pin
PIEBALDconsult17-May-08 5:02
mvePIEBALDconsult17-May-08 5:02 
AnswerRe: why we need registry ? Pin
Hamid_RT17-May-08 7:35
Hamid_RT17-May-08 7:35 
Questionmemory footprint of Dictionary Pin
George_George17-May-08 1:50
George_George17-May-08 1:50 
AnswerRe: memory footprint of Dictionary Pin
Guffa17-May-08 3:26
Guffa17-May-08 3:26 
George_George wrote:
If I call remove method to remove some elements from the Dictionary, will the memory footprint be reduced? (suppose there is no other reference to the removed item) I have some suspecision that Dictionary is not truly removing the element and just mark a flag or something, which still refer this removed item to block it from GCed.


When you remove an item from a dictionary, the key value pair is cleared, but kept. This means that if you store reference types in the dictionary, the reference will be removed. If you store value types in the dictionary, the value is cleared but kept, but that is rarely a problem as value types are small.

If you have made a large structure that you store in a dictionary, removing items would not reduce the memory footprint. But then your problem is that you have constructed a structure that breaks every recommendation, and that it works poorly is not because of a problem with the dictionary.

George_George wrote:
The other is to create a new Dictionary instance, and insert only necessary items into the new Dictionary instance, and reference only the new Dictionary instance in the future.


That would only be beneficial if you have removed a huge number of items from the collection.

George_George wrote:
Which way is better from memory footprint reduce perspective?


Do you think that you have an actual memory footprint problem?

Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: memory footprint of Dictionary Pin
George_George17-May-08 3:35
George_George17-May-08 3:35 
GeneralRe: memory footprint of Dictionary Pin
Guffa17-May-08 6:29
Guffa17-May-08 6:29 
GeneralRe: memory footprint of Dictionary Pin
George_George17-May-08 21:31
George_George17-May-08 21:31 
GeneralRe: memory footprint of Dictionary Pin
Guffa18-May-08 12:34
Guffa18-May-08 12:34 
GeneralRe: memory footprint of Dictionary Pin
George_George20-May-08 22:40
George_George20-May-08 22:40 
GeneralRe: memory footprint of Dictionary Pin
Guffa20-May-08 23:17
Guffa20-May-08 23:17 
GeneralRe: memory footprint of Dictionary Pin
George_George20-May-08 23:43
George_George20-May-08 23:43 
GeneralRe: memory footprint of Dictionary Pin
Guffa21-May-08 3:28
Guffa21-May-08 3:28 
GeneralRe: memory footprint of Dictionary Pin
George_George21-May-08 4:28
George_George21-May-08 4:28 
GeneralRe: memory footprint of Dictionary Pin
Guffa21-May-08 11:17
Guffa21-May-08 11:17 
GeneralRe: memory footprint of Dictionary Pin
George_George25-May-08 1:38
George_George25-May-08 1:38 
GeneralRe: memory footprint of Dictionary Pin
Guffa25-May-08 13:07
Guffa25-May-08 13:07 
GeneralRe: memory footprint of Dictionary Pin
George_George25-May-08 19:14
George_George25-May-08 19:14 
GeneralRe: memory footprint of Dictionary Pin
Guffa25-May-08 22:05
Guffa25-May-08 22:05 
GeneralRe: memory footprint of Dictionary Pin
George_George25-May-08 22:19
George_George25-May-08 22:19 
AnswerRe: memory footprint of Dictionary Pin
PIEBALDconsult17-May-08 5:50
mvePIEBALDconsult17-May-08 5:50 
GeneralRe: memory footprint of Dictionary Pin
George_George17-May-08 21:27
George_George17-May-08 21:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.