문제

Im trying to use the System.Adress_image to list all the adress of the allocated objects in the program.

However I can only print the adress for variables that I have. For example I have a stack and I can print all the stack elements adress. Then I remove the pointer to one of the stacks node so that object is not in the stack anymore.

The removed node is not automatically garbage collected(Ada 2005) so I would like to know the adress of that node. and why not the adress of all the allocated objects in the program?

How may I accomplish this task?

system package: http://www.adaic.org/resources/add_content/standards/05aarm/html/AA-13-7.html

Zombies is referred to "dead objects but still alive".

도움이 되었습니까?

해결책

Two possibilities :

Implement your allocated objects as controlled types, and log their addresses as part of the Initialize, Adjust, Finalize routines.

Implement a custom storage pool for them, with custom allocate and deallocate routines which collect the information you need.

Or alternatively, find a way to use the Ada.Containers library to implement your storage type and let IT worry about cleaning up the zombies...

다른 팁

If you wish to step outside Ada and look for memory leaks, I would reccomend valgrind which will find memory leaks and other gremlins in your program.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top