p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

csharptoday_discuss thread: Using GC.Collect()


Message #1 by "Gerald Leslie" <leslie@a...> on Wed, 19 Dec 2001 11:11:45 +0530
This is a multi-part message in MIME format.



------=_NextPart_000_0000_01C1887D.F1FBB8E0

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: 7bit



hello,

	I have created a class. I have created a instance of the class too.

After that, by using System.GC.GetTotalMemory(true), I checked the memory

allocated by the class. Then I destroyed the instance and I forced the

garbage collection by GC.Collect() method. After that I checked the memory

again. But now the memory size is increased rather decreasing. I dont know

why?. If we force the Garbage collector to collect, will it load the full

garbage collector to the memory?. What are the things will be loaded when we

are instanciating an object. Because before I created the object the size

used by the program was some 1028 bytes. I have created an object of the

class having a private integer and a constructor taking string as an

argument and a static integer member. After creating the object I checked

the size of the memory it was about 2000 bytes. Why it is taking that much

of bytes to allocate for a single and simple object?.

	Thanks in advance

Regards,

leslie



------=_NextPart_000_0000_01C1887D.F1FBB8E0

Content-Type: application/ms-tnef;

	name="winmail.dat"

Content-Transfer-Encoding: base64

Content-Disposition: attachment;

	filename="winmail.dat"



eJ8+Ii0FAQaQCAAEAAAAAAABAAEAAQeQBgAIAAAA5AQAAAAAAADoAAEIgAcAGAAAAElQTS5NaWNy

b3NvZnQgTWFpbC5Ob3RlADEIAQ2ABAACAAAAAgACAAEGgAMADgAAANEHDAATAAsACwAAAAMAEAEB

A5AGAMgGAAAiAAAACwACAAEAAAALACMAAAAAAAMAJgAAAAAACwApAAAAAAADADYAAAAAAB4AcAAB

AAAAEwAAAFVzaW5nIEdDLkNvbGxlY3QoKQAAAgFxAAEAAAAWAAAAAcGIT9G0lBhimTg8SN+x5F2w

iW6I5gAAAgEdDAEAAAAZAAAAU01UUDpMRVNMSUVAQUNDRUxTU0wuQ09NAAAAAAsAAQ4AAAAAQAAG

DgD+Ib1PiMEBAgEKDgEAAAAYAAAAAAAAAMXZC86sC9VCipXglC/WYM7CgAAACw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