Back to index

lightning-sunbird  0.9+nobinonly
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes
nsMemoryImpl Class Reference

#include <nsMemoryImpl.h>

Inheritance diagram for nsMemoryImpl:
Inheritance graph
[legend]
Collaboration diagram for nsMemoryImpl:
Collaboration graph
[legend]

List of all members.

Classes

struct  FlushEvent

Public Member Functions

NS_IMETHOD QueryInterface (REFNSIID aIID, void **aResult)
 NS_IMETHOD_ (nsrefcnt) AddRef(void)
 NS_IMETHOD_ (nsrefcnt) Release(void)
 NS_HIDDEN_ (nsresult) FlushMemory(const PRUnichar *aReason
voidPtr alloc (in size_t size)
 Allocates a block of memory of a particular size.
voidPtr realloc (in voidPtr ptr, in size_t newSize)
 Reallocates a block of memory to a new size.
void free (in voidPtr ptr)
 Frees a block of memory.
void heapMinimize (in boolean immediate)
 Attempts to shrink the heap.
boolean isLowMemory ()
 This predicate can be used to determine if we're in a low-memory situation (what constitutes low-memory is platform dependent).

Static Public Member Functions

static NS_DECL_NSIMEMORY NS_HIDDEN_ (nsresult) Startup()
static NS_HIDDEN_ (void) Shutdown()
static NS_METHOD Create (nsISupports *outer, const nsIID &aIID, void **aResult)

Public Attributes

PRBool aImmediate

Protected Member Functions

 NS_HIDDEN_ (nsresult) RunFlushers(const PRUnichar *aReason)

Static Protected Member Functions

static NS_HIDDEN_ (void *) PR_CALLBACK HandleFlushEvent(PLEvent *aEvent)
static NS_HIDDEN_ (void) PR_CALLBACK DestroyFlushEvent(PLEvent *aEvent)

Static Protected Attributes

static PRLocksFlushLock
static PRBool sIsFlushing = PR_FALSE
static FlushEvent sFlushEvent

Detailed Description

Definition at line 49 of file nsMemoryImpl.h.


Class Documentation

struct nsMemoryImpl::FlushEvent

Definition at line 67 of file nsMemoryImpl.h.

Class Members
PLEvent mEvent
const PRUnichar * mReason

Member Function Documentation

voidPtr nsIMemory::alloc ( in size_t  size) [inherited]

Allocates a block of memory of a particular size.

If the memory cannot be allocated (because of an out-of-memory condition), null is returned.

Parameters:
size- the size of the block to allocate
Returns:
the block of memory
nsresult nsMemoryImpl::Create ( nsISupports *  outer,
const nsIID aIID,
void **  aResult 
) [static]

Definition at line 225 of file nsMemoryImpl.cpp.

Here is the call graph for this function:

void nsIMemory::free ( in voidPtr  ptr) [inherited]

Frees a block of memory.

Null is a permissible value, in which case nothing happens.

Parameters:
ptr- the block of memory to free
void nsIMemory::heapMinimize ( in boolean  immediate) [inherited]

Attempts to shrink the heap.

Parameters:
immediate- if true, heap minimization will occur immediately if the call was made on the main thread. If false, the flush will be scheduled to happen when the app is idle.
Returns:
NS_ERROR_FAILURE if 'immediate' is set an the call was not on the application's main thread.

This predicate can be used to determine if we're in a low-memory situation (what constitutes low-memory is platform dependent).

This can be used to trigger the memory pressure observers.

static NS_DECL_NSIMEMORY nsMemoryImpl::NS_HIDDEN_ ( nsresult  ) [static]
static nsMemoryImpl::NS_HIDDEN_ ( void  ) [static]
nsMemoryImpl::NS_HIDDEN_ ( nsresult  ) const [protected]
static nsMemoryImpl::NS_HIDDEN_ ( void ) [static, protected]
static nsMemoryImpl::NS_HIDDEN_ ( void  ) [static, protected]

Definition at line 54 of file nsMemoryImpl.h.

{ return 1; }

Definition at line 55 of file nsMemoryImpl.h.

{ return 1; }

Here is the caller graph for this function:

voidPtr nsIMemory::realloc ( in voidPtr  ptr,
in size_t  newSize 
) [inherited]

Reallocates a block of memory to a new size.

Parameters:
ptr- the block of memory to reallocate
size- the new size
Returns:
the reallocated block of memory

If ptr is null, this function behaves like malloc. If s is the size of the block to which ptr points, the first min(s, size) bytes of ptr's block are copied to the new block. If the allocation succeeds, ptr is freed and a pointer to the new block returned. If the allocation fails, ptr is not freed and null is returned. The returned value may be the same as ptr.


Member Data Documentation

Definition at line 64 of file nsMemoryImpl.h.

Definition at line 79 of file nsMemoryImpl.h.

PRLock * nsMemoryImpl::sFlushLock [static, protected]

Definition at line 76 of file nsMemoryImpl.h.

PRBool nsMemoryImpl::sIsFlushing = PR_FALSE [static, protected]

Definition at line 77 of file nsMemoryImpl.h.


The documentation for this class was generated from the following files: