Re: [Gc] allocation with lowest overhead
Bruce Hoult <[email protected]> Mon, 26 May 2014 20:13:43 +1200
| Newsgroups | gmane.comp.programming.garbage-collection.boehmgc |
|---|---|
| Message-ID | <CAMU+Ekx2-FXUY81smNJfhtE7Bmi_Y_5tU2-_+7ctKuT1kC04CA@mail.gmail.com> |
GC_MALLOC_WORDS will work. You don't get tiny_fl from somewhere, you allocate it yourself as your own private fast-access cache of objects. As it says in the include file: "Tiny_fl should be an array of GC_TINY_FREELISTS void * pointers." If you're using GC_MALLOC_WORDS() then you can just initialise your tiny_fl array to zeros before the first use. On Mon, May 26, 2014 at 3:57 PM, Kenjiro Taura <[email protected] > wrote: > Hi, > > What is the fastest, yet portable way to allocate > a small object in recent versions (e.g., 7.4.0)? > The current interface seems more complex than what > it used to be many years ago. > > Below, I am seeing 7.4.0 sources. > > I initially thought: > > # define GC_MALLOC_WORDS(result,n,tiny_fl) > > in gc_inline.h is the one I should use, but it > requires tiny_fl argument I must obtain somehow. > > Digging into GC_malloc in thread_local_alloc.c, > I found that the following line eventually gets it. > > tiny_fl = ((GC_tlfs)tsd) -> normal_freelists; > > The next question then is how to get tsd, for > which a fairly complex conditional compilation > is going on. Ignoring portability for a moment, > I figured out that > > tsd = GC_getspecific(GC_thread_key); > > is it. > > I tried copied and pasted it into my source and > got compilation errors. All in all, I feel I am > not on the right track; they seem intentionally > kept private inside a collector implementation. > > I started feeling I am missing some functions that > portably return what needs to be passed to > GC_MALLOC_WORDS, but could not find any so far. > > I appreciate if anybody sheds light on it. > _______________________________________________ > bdwgc mailing list > [email protected] > https://lists.opendylan.org/mailman/listinfo/bdwgc > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > _______________________________________________ bdwgc mailing list [email protected] https://lists.opendylan.org/mailman/listinfo/bdwgc