Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
mac_memory.cpp File Reference
#include <new.h>
#include <stdlib.h>
#include <Files.h>
#include <Memory.h>
#include "DropInCompilerLinker.h"
#include "CompilerMapping.h"
#include "CWPluginErrors.h"

Go to the source code of this file.

Defines

#define TRACK_ALLOCATION
#define kTrackedCookie   'TRKD'

Functions

voidoperator new (size_t size)
void operator delete (void *ptr)
voidoperator new[] (size_t size)
void operator delete[] (void *ptr)
voidstd::malloc (size_t size)
void std::free (void *ptr)
voidstd::calloc (size_t nmemb, size_t size)
voidstd::realloc (void *ptr, size_t size)

Variables

CWPluginContext gPluginContext
const Boolean kTemporaryAllocation = false
 Note: memory allocated by these operators will automatically be freed after the current call into xpidl_compiler completes.

Define Documentation

#define kTrackedCookie   'TRKD'

Definition at line 93 of file mac_memory.cpp.

Definition at line 92 of file mac_memory.cpp.


Function Documentation

void operator delete ( void ptr)

Definition at line 70 of file mac_memory.cpp.

{
       if (ptr != NULL)
              CWFreeMemory(gPluginContext, ptr, kTemporaryAllocation);
}
void operator delete[] ( void ptr)

Definition at line 84 of file mac_memory.cpp.

{
       if (ptr != NULL)
              CWFreeMemory(gPluginContext, ptr, kTemporaryAllocation);
}
void* operator new ( size_t  size)

Definition at line 62 of file mac_memory.cpp.

{
       void* ptr = NULL;
       if (CWAllocateMemory(gPluginContext, size, kTemporaryAllocation, &ptr) == cwNoErr)
              return ptr;
       return NULL;
}
void* operator new[] ( size_t  size)

Definition at line 76 of file mac_memory.cpp.

{
       void* ptr = NULL;
       if (CWAllocateMemory(gPluginContext, size, kTemporaryAllocation, &ptr) == cwNoErr)
              return ptr;
       return NULL;
}

Variable Documentation

CWPluginContext gPluginContext

Definition at line 82 of file mac_xpidl.cpp.

Note: memory allocated by these operators will automatically be freed after the current call into xpidl_compiler completes.

This should be fine in most cases, as we are also having the compiler be reloaded for every request to reinitialize global data. Just be careful out there!

Definition at line 60 of file mac_memory.cpp.