Hi,
I'd like to know what's the main difference between using the malloc/free combination vs. the ___EXT(___alloc_rc) / ___EXT(___alloc_rc) one.
Mi intention is to create C arrays and manage them from the Scheme side, so I can explicitly free them once I need to.
Which one should I use?
Thank you,
Álvaro
Afficher les réponses par date
I'd guess the diffference may be:
* malloc_rc keep a refcount?
* malloc_rc performs the allocation within Gambits memory system? (well, for blocks above 512 bytes, Gambit's memory system makes a separate malloc anyhow, so for your usecase it could be equal in this respect)
You should find the answer by checking the source? Look for the calls called something like inc_rc and dec_rc too.
2013/4/12 Álvaro Castro-Castilla alvaro.castro.castilla@gmail.com
Hi,
I'd like to know what's the main difference between using the malloc/free combination vs. the ___EXT(___alloc_rc) / ___EXT(___alloc_rc) one.
Mi intention is to create C arrays and manage them from the Scheme side, so I can explicitly free them once I need to.
Which one should I use?
Thank you,
Álvaro
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Thanks Mikael,
I want to be able to allocate multiple tiny objects through C interface with multiple calls. I guess for that i better make a custom allocator based on malloc. Otherwise malloc would incur in much overhead if called that many times.
I'm aware that ___alloc_rc does reference counting, but also stores a a pointer to scheme data. I guess that is a just a pointer, but that is an unused pointer.
Thanks! El 12/04/2013 12:41, "Mikael" mikael.rcv@gmail.com escribió:
I'd guess the diffference may be:
malloc_rc keep a refcount?
malloc_rc performs the allocation within Gambits memory system? (well,
for blocks above 512 bytes, Gambit's memory system makes a separate malloc anyhow, so for your usecase it could be equal in this respect)
You should find the answer by checking the source? Look for the calls called something like inc_rc and dec_rc too.
2013/4/12 Álvaro Castro-Castilla alvaro.castro.castilla@gmail.com
Hi,
I'd like to know what's the main difference between using the malloc/free combination vs. the ___EXT(___alloc_rc) / ___EXT(___alloc_rc) one.
Mi intention is to create C arrays and manage them from the Scheme side, so I can explicitly free them once I need to.
Which one should I use?
Thank you,
Álvaro
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list