GC allocation issue
Etienne
etcimon at gmail.com
Fri Mar 21 06:36:42 PDT 2014
On 2014-03-21 2:53 AM, monarch_dodra wrote:
> On Friday, 21 March 2014 at 00:56:22 UTC, Etienne wrote:
>> I'm trying to store a copy of strings for long-running processes with
>> malloc. I tried using emplace but the copy gets deleted by the GC. Any
>> idea why?
>
> Could you show the snippet where you used "emplace"? I'd like to know
> how you are using it. In particular, where you are emplacing, and
> *what*: the slice, or the slice contents?
https://github.com/globecsys/cache.d/blob/master/chd/table.d#L1089
This line does the copying
I don't think it's the memory copying algorithm anymore however. The GC
crashes altogether during fullcollect(), the logs give me this:
> cache-d_d.exe!gc at gc@Gcx at mark(void * this, void * nRecurse, int ptop)
Line 2266 C++
cache-d_d.exe!gc at gc@Gcx at mark(void * this, void * ptop) Line 2249 C++
cache-d_d.exe!gc at gc@Gcx at fullcollect() Line 2454 C++
cache-d_d.exe!gc at gc@GC at mallocNoSync(unsigned int this, unsigned int
alloc_size, unsigned int * alloc_size) Line 458 C++
cache-d_d.exe!gc at gc@GC at malloc(unsigned int this, unsigned int
alloc_size, unsigned int * bits) Line 413 C++
...
With ptop= 03D8F030, pbot= 03E4F030
They both point invalid memory. It looks like a really wide range too,
the usual would be 037CCB80 -> 037CCBA0 or such. I don't know how to
find out where they come from... Maybe I could do an assert on that
specific value in druntime
More information about the Digitalmars-d-learn
mailing list