DomAPI Home
DomAPI

DomAPIX - ActiveX control for memory profiling

DomAPIX is a small ActiveX control that you can download and install on your development box for testing how much memory is consumed by certain parts of your pages. DomAPIX will only work on Windows machines and only on Internet Explorer (or Netscape with the appropriate plugin - not provided).

Installation

1) Download and extract the dll to the directory of your choice (the rest of this article assumes it's in "c:\windows\system32\").
2) Install it by executing the following at a command prompt:
regsvr32 c:\windows\system32\domapix.dll

Since this is an unsigned control, you'll need to configure your security settings to allow you to run it. This will not compromise you security for any other sites. To do this, go to Tools->Internet Options and select the security tab, then click the Custom Level button as shown:

On the dialog that appears, make sure the first three items related to ActiveX are set to "prompt". This will cause IE to prompt you before loading and executing any ActiveX control.

Removal

Should you ever need to remove the control from your machine, perform the following:
1) Execute the following at a command prompt:
regsvr32 c:\windows\system32\domapix.dll /u
2) Delete the dll.
3) Reset your security settings if desired.

Usage

Starting with DomAPI v3.02 you can simply use loadUnit("domapix") to include the object on your page. Otherwise, you can include it manually by adding this to your page:
<OBJECT ID="domapix" CLASSID="CLSID:C9BFEEA7-5118-4BCB-A04C-D58BCD8E9D35"></OBJECT> This will create an instance of the control on your page which you can then access AFTER the page has fully loaded.

This control surfaces 4 methods that deal with memory usage:
FunctionReturn TypeReturns
freePhysMem()integerTotal amount of free physical memory
freePageFileMem()integerTotal amount of free page file memory
freeVirtualMem()integerTotal amount of free virtual memory
usedProcMem()integerTotal amount memory used by Internet Explorer

usedProcMem() is probably the one you'll find most useful. Here is an example of finding out how much ram is consumed by a particular operation. Remember that this can only be done after onload has fired.

  function myFunc(){
    var startRam = domapix.usedProcMem();
    // do some heavy operation here
    var endRam = domapix.usedProcMem();
    alert("Memory used is:" + (endRam - startRam));
  };

Comments, suggestions, etc...

TERMS OF USE:
This application's intended purpose is as an off-line utility. By downloading this application, you agree to use it only for it's intended purpose. You may not distribute the application by any bundling mechanism. Nor can you include the application with any software distribution. Advanced licensing options are available through the author.

"DomAPI" and it's parent "Nebiru Software" makes not warranties, expressed or implied against the use of this software. Use it at your own risk. Always backup your files before use. "DomAPI" and it's parent "Nebiru Software" cannot be held responsible for lost or corrupted data.

  Download  
  domapix.zip 2/13/08 (65.6 KB)  
       
DHTML by www.domapi.com