libredwg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libredwg] large file patches and issues


From: gagan
Subject: Re: [libredwg] large file patches and issues
Date: Mon, 13 Oct 2014 23:36:51 +0530

On Mon, May 12, 2014 at 10:40 AM, Dave Bender <address@hidden> wrote:
>
> Dear List,
>   I was working with a file containing 660,000 entries and had to make some 
> changes. I use a hash table for handle->object index resolution to improve 
> the parse performance by orders of magnitude (down from 14 minutes to 2 
> seconds). I also put in some const correctness because that's just basic. My 
> git repo is here: https://github.com/benegon/libredwg
>
> Now for the bad news: I noticed LibreDWG stores pointers into arrays that are 
> realloced, namely
>
> Dwg_Data.layer_control points into Dwg_Data.object, but this array is 
> continually realloced and the base pointer may change.
> Dwg_Data.header.section_info also seems to be afflicted by this bug.
>
> Possible Dwg_Data.dwg_class* as well.
>
> YOU CANNOT STORE POINTERS INTO THESE ARRAYS; realloc can move the whole array 
> somewhere else, so please store the offsets instead and calculate the pointer 
> when needed. This is probably why some people have been seeing memory 
> corruption.
>
> For my own purposes I will initialize the number of objects to 1000000 or 
> more, depending on how big my files get. Hopefully you guys can resolve this 
> memory issue.

Thanks for the help Dave, I'll look into it soon.

-- 
Thanks
Gaganjyot
"Jai Sai Naath"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]