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@gc@Gcx@mark(void * this, void * nRecurse, int ptop)
Line 2266 C++
cache-d_d.exe!gc@gc@Gcx@mark(void * this, void * ptop) Line 2249
C++
cache-d_d.exe!gc@gc@Gcx@fullcollect() Line 2454 C++
cache-d_d.exe!gc@gc@GC@mallocNoSync(unsigned int this, unsigned int
alloc_size, unsigned int * alloc_size) Line 458 C++
cache-d_d.exe!gc@gc@GC@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