Skip to main content
Participant
September 13, 2013
Answered

TrackAllocation asserts: why? How to get rid of it?

  • September 13, 2013
  • 1 reply
  • 1104 views

I am having trouble with this kind of assert with InDesign CS5.5. Here at my company we developed a plug-in that exists since InDesign 2.0 and CS3, running without any problem other than bugs within itself. But since we managed to get the Debug version of InDesign CS5.5 to track our code, I got HUNDRENDS of this warning. Most of it related to K2 collections and iteration, like:

- when I duplicate a AttributeBossList;

- when I use a K2Vector with some datatypes;

- when I use the IParcelList::iterator;

- when I use the IIntegratorTarget::GetTarget method;

- among other cases.

I tried to reduce the messages, by replacing K2Vector with std::vector, but that wasn't enough. I suspect it is caused by some mixed memory reallocation and the InDesign debug tracker got lost somehow, but have no clue of WHY. Because of that huge amount of asserts, the debuging process became quite useless

Does anyone know WHAT should a look for, and where, to see WHY is this hapenning?

This topic has been closed for replies.
Correct answer Dirk Becker

There is a special case in the C++ standard: the linker handles overloading of operator delete, standard library provides a "weak" symbol for fallback. Your project is missing some SDK library. Don't ask me which, compare the linker command in the build log to that of a working SDK plugin.

Dirk

1 reply

Participant
September 17, 2013

I think I got around this. Looks like the delete operator is not properly overloaded by the InDesign SDK at my plugin compilation (don't know why), and so it wasn't calling the method K2Memory::RTLCompatibleDeleteDelegate. The solution I found out is to call myself this method, to delete pointers returned to me by other InDesign Plugins or core library (PMRuntime.lib)

Dirk BeckerCorrect answer
Legend
September 17, 2013

There is a special case in the C++ standard: the linker handles overloading of operator delete, standard library provides a "weak" symbol for fallback. Your project is missing some SDK library. Don't ask me which, compare the linker command in the build log to that of a working SDK plugin.

Dirk

September 17, 2013

Well, as allways has been we link the plugin agains PMRuntime.lib, Public.lib and WidgetBin.lib, among others from 3rd parties. Could it be a linking priority mismatch, like the one present at PMRuntime.lib not being use as the effective overload for the delete operator? If so, I have no CLUE how to solve it, as the PMRuntime.lib is the first listed library for linking :-/


Problem solved. The PMRuntime.lib was in fact NOT the first listed library in order. It was being linked with a #pragma comment directive, and I believe that caused the library to be placed waaaay after all the default VC++ libs and dependency projects, masking the InDesign overloads for the operators. Now all works well, no more hundreds of asserts out of nowere. Thanks for the tip about the overloading

Edit: I didn't tested properly. The problem persists. Still researching

Edit 2: Ok, now I placed all 3 (PMRuntime.lib, Public.lib and WidgetBin.lib of then at the project properties instead of using #pragma comment, and now all works fine)