Question about Pools

Hello,

I have some questions about Pool Allocation

Is it possible for a program to access and manipulate an (automatically allocated) pool at run time? For example, if a program wants to dump all the allocated pools that is using, is it possible to enumerate all those pools and access them (contents and information about the pool) and then dump all this information to a file?

Also, please correct me if I am wrong. I understand that if in a program there are two disjoint data structures and this data structure has 4 different kinds of nodes (heterogeneous nodes), the runtime system is going to create 8 different pools? :

2 disjoint “instances” (e.g., two complete trees) of the same data structure * 4 kinds of nodes = 8 different pools

At runtime, Can I identify all the pools that belong to a specific instance of any of the data structures and then dump only the pools that belong to that specific instance?

Thanks

Hello,

I have some questions about Pool Allocation

Is it possible for a program to access and manipulate an (automatically allocated) pool at run time? For example, if a program wants to dump all the allocated pools that is using, is it possible to enumerate all those pools and access them (contents and information about the pool) and then dump all this information to a file?

Yes, but not in any simple way. You basically have to hack the pool runtime to do the stuff you want. If you look at the actual runtime we use by default (llvm-poolalloc/runtime/FL2Allocator/), you can see there are various #defines you can enable for debugging in the .cpp file:

#ifndef NDEBUG
// Configuration macros. Define up to one of these.
//#define PRINT_NUM_POOLS // Print use dynamic # pools info
//#define PRINT_POOLDESTROY_STATS // When pools are destroyed, print stats
#define PRINT_POOL_TRACE // Print a full trace
#endif

Also, please correct me if I am wrong. I understand that if in a program there are two disjoint data structures and this data structure has 4 different kinds of nodes (heterogeneous nodes), the runtime system is going to create 8 different pools? : 2 disjoint "instances" (e.g., two complete trees) of the same data structure * 4 kinds of nodes = 8 different pools.

Yes, that's the idea. Up to the limit of what the pointer analysis (which tends to be very good) can prove though.

At runtime, Can I identify all the pools that belong to a specific instance of any of the data structures and then dump only the pools that belong to that specific instance?

Today, not really. However, it would be straight-forward to add ID numbers to the pool creation sites and record the info in the pool descriptor.

What are you goals with pool allocation btw?

-Chris

Hello,

Thanks for your answer