Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to use malloc instead of the internal memory allocator

2 views
Skip to first unread message

Bradley C. Kuszmaul

unread,
Jan 8, 2015, 4:35:07 PM1/8/15
to bug-gho...@gnu.org
Hi ghostscripters,

I'm benchmarking malloc(), and I'm asking you for help for benchmarking malloc() with ghostscript.

Historically, papers about new implementations of malloc have benchmarked ghostscript, along with many other experiments.  They have had some trouble measuring performance, since ghostscript uses its own allocator. For example Evans06 says (http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf)

> gs overwhelmingly allocates either 240-byte objects or large objects, since it uses a custom allocator
> internally. As a result, this benchmark stresses performance of large object allocation.

I was wondering if there is any way to convince gs to simply call malloc() and free() for every object it wants, instead of using its internal allocator.  I've looked (briefly) at the code in gsmalloc.c and gsmemory.c, and it's not clear whether this is reasonable idea. The comments talk about garbage collection and object relocation, so maybe it's just infeasible to think of calling malloc() and free() on every object.  

So here are my questions:
 1) Is the internal allocator in ghostscript used primarily for performance, or for features such as garbage collection?
 2) Would it be possible to use malloc/free more heavily so that I can find out how much of a performance difference there is?  How would I do that?

Any help would be appreciated.

-Bradley


 
0 new messages