Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions
nsRecyclingAllocatorImpl Class Reference

#include <nsRecyclingAllocator.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIMEMORY
NS_DECL_NSIRECYCLINGALLOCATOR 
nsRecyclingAllocatorImpl ()
void init (in size_t nblocks, in size_t recycleAfter, in string id)
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).

Private Member Functions

 ~nsRecyclingAllocatorImpl ()

Detailed Description

Definition at line 195 of file nsRecyclingAllocator.h.


Constructor & Destructor Documentation

NS_DECL_ISUPPORTS NS_DECL_NSIMEMORY NS_DECL_NSIRECYCLINGALLOCATOR nsRecyclingAllocatorImpl::nsRecyclingAllocatorImpl ( ) [inline]

Definition at line 201 of file nsRecyclingAllocator.h.

    {
    }

Definition at line 206 of file nsRecyclingAllocator.h.

{}

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
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.
void nsIRecyclingAllocator::init ( in size_t  nblocks,
in size_t  recycleAfter,
in string  id 
) [inherited]

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.

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.


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