高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】memory allocation errors
memory allocation errors
memory allocation errors
i'm currently using dd_vc6.dll of 30th may with visual studio .net, and am getting crashes on repeat loads-i.e. the first file loads ok (and all instances of dwgdirect classes are destructed), but later ones crash, but it seems a little more complicated than that. i've therefore run using boundschecker, and it reports a number of cases of using free on a pointer to memory allocated by new (the precise error is "allocation conflict: attempting to call free on pointer 0x9133308, that was allocated by global_operator_new."). i'm not able to verify this since i don't have access to source code, but it might be worth checking if there is an issue. i'm using code with minimal changes from the sample code for classes such as exsystemservices, although the code for interpreting the data is different.
are you using new operator to create dd objects or createobject() function?
sergey slezkin
i've only been reading dwg files, so haven't been creating new objects, except for things like odgepoint2darray used to get at the data, which i simply declare (i.e. on the heap), and one or two cases where i have oddbobjectid objects as members of classes instantiated with new or used in an std::set. i've left classes such as exsystemservices more-or-less as they are, and they make some use of new, but i suspect i wasn't using the relevant parts anyway (presumably the code for loading raster images etc. is only used for rendering?).
it's difficult to discuss the problem without ability to reproduce it...
some time ago a bug was fixed which occured if odinitialize() / od uninitialize() were called multiple times. maybe your build contains this bug. does your application call these functions once?
sergey slezkin
i am experiencing the same problem. has anyone been able to fix this problem? i am creating multiple service and calling multiple odinitialize because i have one for loading dwg files and another one for saving dwg files. could this be the problem?
thanks in advance
see
sergey slezkin
it doesn't have to do with odinitialize because i put a break point there and it doesn't execute on the odinitialize at all. the really odd thing about this is what i was able to make one project setting to work without any heap problem. however other project settings still causes the heap problems.
odinitialize() must be called once at least.
depending on project settings you need to use correct dd libraries (md/ml/mt debug/release) and correct ms run-time ones.
sergey slezkin
i think i may have solved the problem. the problem was because i was linking the release mode dll in debug mode. that was why it was trying to call a release mode "free".
here is another request. can we rename the debug dll's such that they have "dbg" at the beginning of the file name (i.e. dbg_dd_dd.dll). this is what most developers are doing and makes linking much easier.
thanks
|