+1998-08-18: Elliot Lee <sopwith@redhat.com>
+
+ . In gmem.c, add the ability to exclude memory chunks from the
+ memory profiling information.
+
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
+1998-08-18: Elliot Lee <sopwith@redhat.com>
+
+ . In gmem.c, add the ability to exclude memory chunks from the
+ memory profiling information.
+
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
+1998-08-18: Elliot Lee <sopwith@redhat.com>
+
+ . In gmem.c, add the ability to exclude memory chunks from the
+ memory profiling information.
+
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
+1998-08-18: Elliot Lee <sopwith@redhat.com>
+
+ . In gmem.c, add the ability to exclude memory chunks from the
+ memory profiling information.
+
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
+1998-08-18: Elliot Lee <sopwith@redhat.com>
+
+ . In gmem.c, add the ability to exclude memory chunks from the
+ memory profiling information.
+
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
+1998-08-18: Elliot Lee <sopwith@redhat.com>
+
+ . In gmem.c, add the ability to exclude memory chunks from the
+ memory profiling information.
+
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
+1998-08-18: Elliot Lee <sopwith@redhat.com>
+
+ . In gmem.c, add the ability to exclude memory chunks from the
+ memory profiling information.
+
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
+1998-08-18: Elliot Lee <sopwith@redhat.com>
+
+ . In gmem.c, add the ability to exclude memory chunks from the
+ memory profiling information.
+
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
#include "glib.h"
/* #define ENABLE_MEM_PROFILE */
+/* #define ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS */
/* #define ENABLE_MEM_CHECK */
+#if defined(ENABLE_MEM_PROFILE) && defined(ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS)
+#define ENTER_MEM_CHUNK_ROUTINE() allocating_for_mem_chunk++
+#define LEAVE_MEM_CHUNK_ROUTINE() allocating_for_mem_chunk--
+#else
+#define ENTER_MEM_CHUNK_ROUTINE()
+#define LEAVE_MEM_CHUNK_ROUTINE()
+#endif
+
#define MAX_MEM_AREA 65536L
#define MEM_AREA_SIZE 4L
static gulong allocations[4096] = { 0 };
static gulong allocated_mem = 0;
static gulong freed_mem = 0;
+static gint allocating_for_mem_chunk = 0;
#endif /* ENABLE_MEM_PROFILE */
*t = size;
#ifdef ENABLE_MEM_PROFILE
- if (size <= 4095)
- allocations[size-1] += 1;
- else
- allocations[4095] += 1;
- allocated_mem += size;
+#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
+ if(!allocating_for_mem_chunk) {
+#endif
+ if (size <= 4095)
+ allocations[size-1] += 1;
+ else
+ allocations[4095] += 1;
+ allocated_mem += size;
+#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
+ }
+#endif
#endif /* ENABLE_MEM_PROFILE */
#endif /* ENABLE_MEM_PROFILE || ENABLE_MEM_CHECK */
*t = size;
#ifdef ENABLE_MEM_PROFILE
- if (size <= 4095)
- allocations[size-1] += 1;
- else
- allocations[4095] += 1;
- allocated_mem += size;
+#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
+ if(!allocating_for_mem_chunk) {
+#endif
+ if (size <= 4095)
+ allocations[size-1] += 1;
+ else
+ allocations[4095] += 1;
+ allocated_mem += size;
+#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
+ }
+#endif
#endif /* ENABLE_MEM_PROFILE */
#endif /* ENABLE_MEM_PROFILE */
*t = size;
#ifdef ENABLE_MEM_PROFILE
- if (size <= 4095)
- allocations[size-1] += 1;
- else
- allocations[4095] += 1;
- allocated_mem += size;
+#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
+ if(!allocating_for_mem_chunk) {
+#endif
+ if (size <= 4095)
+ allocations[size-1] += 1;
+ else
+ allocations[4095] += 1;
+ allocated_mem += size;
+#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
+ }
+#endif
#endif /* ENABLE_MEM_PROFILE */
#endif /* ENABLE_MEM_PROFILE || ENABLE_MEM_CHECK */
{
GRealMemChunk *mem_chunk;
gulong rarea_size;
-
+
+ ENTER_MEM_CHUNK_ROUTINE();
+
mem_chunk = g_new (struct _GRealMemChunk, 1);
mem_chunk->name = name;
mem_chunk->type = type;
if (mem_chunks)
mem_chunks->prev = mem_chunk;
mem_chunks = mem_chunk;
-
+
+ LEAVE_MEM_CHUNK_ROUTINE();
+
return ((GMemChunk*) mem_chunk);
}
GMemArea *temp_area;
g_assert (mem_chunk != NULL);
-
+
+ ENTER_MEM_CHUNK_ROUTINE();
+
rmem_chunk = (GRealMemChunk*) mem_chunk;
mem_areas = rmem_chunk->mem_areas;
g_tree_destroy (rmem_chunk->mem_tree);
g_free (rmem_chunk);
+
+ LEAVE_MEM_CHUNK_ROUTINE();
}
gpointer
GRealMemChunk *rmem_chunk;
GMemArea *temp_area;
gpointer mem;
-
+
+ ENTER_MEM_CHUNK_ROUTINE();
+
g_assert (mem_chunk != NULL);
rmem_chunk = (GRealMemChunk*) mem_chunk;
rmem_chunk->mem_area->index += rmem_chunk->atom_size;
rmem_chunk->mem_area->free -= rmem_chunk->atom_size;
rmem_chunk->mem_area->allocated += 1;
-
- outa_here:
+
+outa_here:
+
+ LEAVE_MEM_CHUNK_ROUTINE();
+
return mem;
}
g_assert (mem_chunk != NULL);
g_assert (mem != NULL);
-
+
+ ENTER_MEM_CHUNK_ROUTINE();
+
rmem_chunk = (GRealMemChunk*) mem_chunk;
/* Don't do anything if this is an ALLOC_ONLY chunk
rmem_chunk->num_marked_areas += 1;
}
}
+
+ LEAVE_MEM_CHUNK_ROUTINE();
}
/* This doesn't free the free_area if there is one */
#include "glib.h"
/* #define ENABLE_MEM_PROFILE */
+/* #define ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS */
/* #define ENABLE_MEM_CHECK */
+#if defined(ENABLE_MEM_PROFILE) && defined(ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS)
+#define ENTER_MEM_CHUNK_ROUTINE() allocating_for_mem_chunk++
+#define LEAVE_MEM_CHUNK_ROUTINE() allocating_for_mem_chunk--
+#else
+#define ENTER_MEM_CHUNK_ROUTINE()
+#define LEAVE_MEM_CHUNK_ROUTINE()
+#endif
+
#define MAX_MEM_AREA 65536L
#define MEM_AREA_SIZE 4L
static gulong allocations[4096] = { 0 };
static gulong allocated_mem = 0;
static gulong freed_mem = 0;
+static gint allocating_for_mem_chunk = 0;
#endif /* ENABLE_MEM_PROFILE */
*t = size;
#ifdef ENABLE_MEM_PROFILE
- if (size <= 4095)
- allocations[size-1] += 1;
- else
- allocations[4095] += 1;
- allocated_mem += size;
+#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
+ if(!allocating_for_mem_chunk) {
+#endif
+ if (size <= 4095)
+ allocations[size-1] += 1;
+ else
+ allocations[4095] += 1;
+ allocated_mem += size;
+#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
+ }
+#endif
#endif /* ENABLE_MEM_PROFILE */
#endif /* ENABLE_MEM_PROFILE || ENABLE_MEM_CHECK */
*t = size;
#ifdef ENABLE_MEM_PROFILE
- if (size <= 4095)
- allocations[size-1] += 1;
- else
- allocations[4095] += 1;
- allocated_mem += size;
+#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
+ if(!allocating_for_mem_chunk) {
+#endif
+ if (size <= 4095)
+ allocations[size-1] += 1;
+ else
+ allocations[4095] += 1;
+ allocated_mem += size;
+#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
+ }
+#endif
#endif /* ENABLE_MEM_PROFILE */
#endif /* ENABLE_MEM_PROFILE */
*t = size;
#ifdef ENABLE_MEM_PROFILE
- if (size <= 4095)
- allocations[size-1] += 1;
- else
- allocations[4095] += 1;
- allocated_mem += size;
+#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
+ if(!allocating_for_mem_chunk) {
+#endif
+ if (size <= 4095)
+ allocations[size-1] += 1;
+ else
+ allocations[4095] += 1;
+ allocated_mem += size;
+#ifdef ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS
+ }
+#endif
#endif /* ENABLE_MEM_PROFILE */
#endif /* ENABLE_MEM_PROFILE || ENABLE_MEM_CHECK */
{
GRealMemChunk *mem_chunk;
gulong rarea_size;
-
+
+ ENTER_MEM_CHUNK_ROUTINE();
+
mem_chunk = g_new (struct _GRealMemChunk, 1);
mem_chunk->name = name;
mem_chunk->type = type;
if (mem_chunks)
mem_chunks->prev = mem_chunk;
mem_chunks = mem_chunk;
-
+
+ LEAVE_MEM_CHUNK_ROUTINE();
+
return ((GMemChunk*) mem_chunk);
}
GMemArea *temp_area;
g_assert (mem_chunk != NULL);
-
+
+ ENTER_MEM_CHUNK_ROUTINE();
+
rmem_chunk = (GRealMemChunk*) mem_chunk;
mem_areas = rmem_chunk->mem_areas;
g_tree_destroy (rmem_chunk->mem_tree);
g_free (rmem_chunk);
+
+ LEAVE_MEM_CHUNK_ROUTINE();
}
gpointer
GRealMemChunk *rmem_chunk;
GMemArea *temp_area;
gpointer mem;
-
+
+ ENTER_MEM_CHUNK_ROUTINE();
+
g_assert (mem_chunk != NULL);
rmem_chunk = (GRealMemChunk*) mem_chunk;
rmem_chunk->mem_area->index += rmem_chunk->atom_size;
rmem_chunk->mem_area->free -= rmem_chunk->atom_size;
rmem_chunk->mem_area->allocated += 1;
-
- outa_here:
+
+outa_here:
+
+ LEAVE_MEM_CHUNK_ROUTINE();
+
return mem;
}
g_assert (mem_chunk != NULL);
g_assert (mem != NULL);
-
+
+ ENTER_MEM_CHUNK_ROUTINE();
+
rmem_chunk = (GRealMemChunk*) mem_chunk;
/* Don't do anything if this is an ALLOC_ONLY chunk
rmem_chunk->num_marked_areas += 1;
}
}
+
+ LEAVE_MEM_CHUNK_ROUTINE();
}
/* This doesn't free the free_area if there is one */