[pypy-dev] Best way to inline a primitive array in RPython?

Timothy Baldridge tbaldridge at gmail.com
Mon Oct 29 19:41:07 EDT 2018


Looking at rbuffer, rgc, and the lltype namespaces, it's not completely
clear to me how I would go about writing a struct with a resizable
primitive array inlined.

Something like:

typedef struct foo_t {
int a, b;
int _data[0];
}

foo_t tmp = malloc(sizeof(foo_t) + 64);

I can see that the GC has the ability to allocate "extra" memory beyond
what's required for a struct, and that lltype has the ability to inline
some lists into a struct, but how does this work in practice? And maybe I'm
missing something in the docs, so simply pointing me to some docs is also
fine.


-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20181029/9041aa50/attachment.html>


More information about the pypy-dev mailing list