A day with .Net

My day to day experince in .net

Archive for July, 2016

Restart Amazon AWS EC2 instance from PowerShell

Posted by vivekcek on July 25, 2016

In this post i will show you how can we restart a windows ec2 instance by using powershell.

1. Go to your account, select Security Credentials and create an AWS access key and secret key.

2

3

2. Open Power-Shell for AWS, which will ask your AWS Access key and Secret Key.

1

3. If Power-Shell not prompted for keys go to “C:\Users\Administrator\AppData\Local\AWSToolkit” and delete the Registered Account Jsonfile and open Power-Shell again.

4. Now get your instance id by using this url from EC2 instance

http://169.254.169.254/latest/meta-data/instance-id

5. Now from powershell give below command

Restart-EC2Instance -InstanceId i-12345678

Posted in Amazon AWS | Tagged: , , , | Leave a Comment »

C# Different Types Of Heap Memory

Posted by vivekcek on July 10, 2016

You might be heard that, reference objects are stored in heap:).
Do you know how many types of heaps are available in CLR.
Do you know that, you can pass data to another app domain with out marshaling:)

These all are .NET CLR implementation details, know to Bill Gates:)

You can explore, if you want to know more, Later i will post about memory management in CLR.

For the time being have a look at the types of heap’s below.

Loader Heap: contains CLR structures and the type system
High Frequency Heap: statics, MethodTables, FieldDescs, interface map
Low Frequency Heap: EEClass, ClassLoader and lookup tables
Stub Heap: stubs for CAS, COM wrappers, PInvoke
Large Object Heap: memory allocations that require more than 85k bytes
GC Heap: user allocated heap memory private to the app
JIT Code Heap: memory allocated by mscoreee (Execution Engine) and the JIT compiler for managed code
Process/Base Heap: interop/unmanaged allocations, native memory, etc

Usually, the “heaps” that most people refer to or know about are the “GC Heap” and the LOH.
GC Heap is shared among app-domains and GC will work only on that.

Capture

Posted in c#.net | Tagged: , , , , , , , , | Leave a Comment »