Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions
libmalloc.h File Reference
#include <sys/types.h>
#include <malloc.h>
#include "config.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  malloc_log_entry
struct  malloc_map_entry

Defines

#define malloc_log_malloc   0
#define malloc_log_realloc   1
#define malloc_log_free   2
#define malloc_log_new   3
#define malloc_log_delete   4
#define malloc_log_addref   5
#define malloc_log_release   6
#define LIBMALLOC_LOG   0x1
#define LIBMALLOC_NOFREE   0x2
#define LIBMALLOC_CHECK   0x4
#define LIBMALLOC_LOG_RC   0x8

Typedefs

typedef unsigned long u_long

Functions

u_long SetMallocFlags (u_long flags)
void __log_addref (void *p, int oldrc, int newrc)
void __log_release (void *p, int oldrc, int newrc)

Class Documentation

struct malloc_log_entry

Definition at line 54 of file libmalloc.h.

Collaboration diagram for malloc_log_entry:
Class Members
u_long address
u_long numpcs
u_long oldaddress
char * pcs
u_long size
u_long type
struct malloc_map_entry

Definition at line 74 of file libmalloc.h.

Collaboration diagram for malloc_map_entry:
Class Members
u_long address
u_long nameLen

Define Documentation

Definition at line 94 of file libmalloc.h.

#define LIBMALLOC_LOG   0x1

Definition at line 88 of file libmalloc.h.

Definition at line 97 of file libmalloc.h.

Definition at line 91 of file libmalloc.h.

Definition at line 69 of file libmalloc.h.

Definition at line 68 of file libmalloc.h.

Definition at line 66 of file libmalloc.h.

Definition at line 64 of file libmalloc.h.

Definition at line 67 of file libmalloc.h.

Definition at line 65 of file libmalloc.h.

Definition at line 70 of file libmalloc.h.


Typedef Documentation

typedef unsigned long u_long

Definition at line 50 of file libmalloc.h.


Function Documentation

void __log_addref ( void p,
int  oldrc,
int  newrc 
)

Definition at line 589 of file libmalloc.cpp.

{
  if (gFirstTime) {
    Init();
  }
  if (LIBMALLOC_LOG_RC & gFlags) {
    Log(malloc_log_addref, p, size_t(oldrc), (void*)newrc);
  }
}

Here is the call graph for this function:

void __log_release ( void p,
int  oldrc,
int  newrc 
)

Definition at line 600 of file libmalloc.cpp.

{
  if (gFirstTime) {
    Init();
  }
  if (LIBMALLOC_LOG_RC & gFlags) {
    Log(malloc_log_release, p, size_t(oldrc), (void*)newrc);
  }
}

Here is the call graph for this function:

Definition at line 334 of file libmalloc.cpp.

{
  u_long old = gFlags;
  gFlags = aFlags;

  if ((-1 == gLogFD) && ((LIBMALLOC_LOG|LIBMALLOC_LOG_RC) & gFlags)) {
    gLogFD = open("malloc-log", O_CREAT|O_WRONLY|O_TRUNC, 0666);
    if (gLogFD < 0) {
      gFlags &= ~LIBMALLOC_LOG;
      printf("unable to create malloc-log: %d\n", errno);
    }
  }
  if ((gLogFD >= 0) && (0 == ((LIBMALLOC_LOG|LIBMALLOC_LOG_RC) & gFlags))) {
    close(gLogFD);
    gLogFD = -1;
  }
#ifndef NTO
  if (LIBMALLOC_CHECK & gFlags) {
    mallopt(M_CHECK_ACTION, 1);
  }
#endif

  // Try to guarantee that the address map is always dumped
  atexit(DumpAddressMap);

  return old;
}

Here is the caller graph for this function: