Heap management when script crashes

Hello

In some cint script I have some class objects which are local to a function. However if there is an error in the function libcint bombs out and the heap is not cleaned thus triggering code guard to report of resource leakages if it is enabled.

I can clean up the heap later for dynamically allocated objects within the class itself but it appears that cint uses the heap to allocate local variables rather than the stack and I still get small resource leakages if the function has an error in it such as an undefined function call. Otherwise if there are no errors in the code there are no problems with resource leakages.

Is there a function I can call that will clean up the heap in case of a major error ??

regards
david

Hi,

You might get the desired effect by calling G__free_tempobject.

Cheers,
Philippe.

Hello Phillipe

Unfortunately G__free_tempobject() is not exported in the libcint.dll

Also I found another function which could be useful called G__garbagecollection() which is also not exported :frowning:

regards
david

[quote]Unfortunately G__free_tempobject() is not exported in the libcint.dll [/quote]Humm … strange … It is listed in G__ci.h and is used in ROOT’s libCore (so it seems to be exported).

Cheers,
Philippe.

[quote=“pcanal”][quote]Unfortunately G__free_tempobject() is not exported in the libcint.dll [/quote]Humm … strange … It is listed in G__ci.h and is used in ROOT’s libCore (so it seems to be exported).

Cheers,
Philippe.[/quote]

Hello Philippe

I am using 5.15.174 so maybe that’s the difference or is there some switch when you build cint to enable it ??

regards
david

Hi,

Indeed, it was introduced/exported in CINT 5-16-13.

Cheers,
Philippe.

Hello Phillipe

Could I mod the G__ci.h and make it exportable ??

regards
david

HI,

Yes this should work (or you can upgrade to the newer/better version :slight_smile:).

Cheers,
Philippe.

[quote=“pcanal”]HI,

Yes this should work (or you can upgrade to the newer/better version :slight_smile:).

Cheers,
Philippe.[/quote]

I’m stuck with the old version because I couldn’t get any of the newer versions work with the borland compiler :frowning:

It seems to work really well and does everything I need of it :wink:

regards
david