Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. COM
  4. Memory Allocation of COM Objects

Memory Allocation of COM Objects

Scheduled Pinned Locked Moved COM
questioncomperformance
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Killer3
    wrote on last edited by
    #1

    Hi Question 1: When we create an COM object in a Process where does the memory of the COM objects get allocation? Question 2: Does the memory allocated to the COM object contributed to increase in Virtual memory of the process where it is instantiated.? Question 3: What is the relation between virtual memory of a process and private bytes of the process?

    for Ilanthendral**(KillerInstincts)**

    M 1 Reply Last reply
    0
    • K Killer3

      Hi Question 1: When we create an COM object in a Process where does the memory of the COM objects get allocation? Question 2: Does the memory allocated to the COM object contributed to increase in Virtual memory of the process where it is instantiated.? Question 3: What is the relation between virtual memory of a process and private bytes of the process?

      for Ilanthendral**(KillerInstincts)**

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      R.ilan thendral wrote:

      Question 1: When we create an COM object in a Process where does the memory of the COM objects get allocation?

      Wherever the code that implements the class factory allocates it. Typically this will be on one of the heaps but sometimes a small number of static objects are used.

      Question 2: Does the memory allocated to the COM object contributed to increase in Virtual memory of the process where it is instantiated.?

      Potentially. The heap manager manages a large block of virtual address space for each heap, so sometimes allocating from the heap can be satisfied from the existing virtual address space allocated to the heap, and sometimes the heap has to grow to satisfy the new allocation.

      Question 3: What is the relation between virtual memory of a process and private bytes of the process?

      It's hard to do justice to that question in a small amount of space. The virtual address space is how the process views memory; at any time, most of the virtual address space isn't backed by anything - if you try to write to or read from them, you just get an access violation. Virtual addresses can be mapped to memory-mapped files, shared memory sections, can be marked as reserved, or can point to memory that can only be accessed by this process - these are 'private bytes'. Task Manager confuses everything by referring to 'private bytes' as 'VM Size'. In turn, only some of the process's virtual addresses are actually in physical memory at any given time. The working set ('Mem Usage' in Task Manager) is the set of pages belonging to the process (memory-mapped files, shared, or private) which are currently in physical memory. The processor and operating system work together to give the illusion that the code and/or data are all accessible; if the process references (reads from or writes to) a page not currently in physical memory, the processor raises a page fault exception, which the OS handles by reading the page from disk, then setting a data structure (the page table entry) to point to the physical memory containing that page.

      Stability. What an interesting concept. -- Chris Maunder

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups