a1ext / labeless

Labeless is a multipurpose IDA Pro plugin system for labels/comments synchronization with a debugger backend, with complex memory dumping and interactive Python scripting capabilities.
Other
515 stars 81 forks source link

IDA pro shows out of memory when import 50MB exe by labeless #57

Open anaivebird opened 3 years ago

anaivebird commented 3 years ago

It seems that IDA's default database memory config is as following: (copy from ida.cfg) // Memory configuration parameters // ------------------------------- // NOTES: // // 1. DATABASE_MEMORY determines how much memory will be allocated // for names, strings, xrefs, functions, etc. If it is == 0 then // IDA uses the following alrogithm: // // DATABASE_MEMORY = new_file // ? input_file_size 4 // : old_btree_size/2 // IDA never allocates more than 128MB in this case. // // 2. page sizes (VPAGESIZE and NPAGESIZE) must be powers of 2. // // 3. if VPAGES == 0 then 32bit IDA reserves memory by the following // alrogithm: // // VMEM = new_file // ? input_file_size4 // : allocated_addressing_space; // // VPAGES = VMEM / VPAGESIZE // // 4. Here is the total amount of memory allocated when IDA starts: // // TOTAL = DATABASE_MEMORY + VPAGESIZEVPAGES + NPAGESIZENPAGES // DATABASE_MEMORY = 0 // Size of btree buffer in bytes. VPAGESIZE = 8192 // Virtual memory page size // (effective for new bases only) // 8192 => 128MB addressing space is the limit VPAGES = 0 // Size of virtual memory window // (in pages) NPAGESIZE = 8192 // Name pointers page size // (effective for new bases only) NPAGES = 32 // how big will be the memory buffer? // (each name uses 4 bytes) // The default settings allow to keep // in memory 2^16 names. The remaining // names will be swapped to the disk.

That is: DATABASE_MEMORY = new_file ? input_file_size 4 : old_btree_size/2 VMEM = new_file ? input_file_size4 : allocated_addressing_space

Since labeless creates stub database which is very small, the database limit is very low, and prone to out of memory.

My solution is to manually change the limit to solve it.

But I wonder why IDA pro limit database_memory to 2GB and VMEM to 1GB, when I have 1TB NVMe SSD and 32GB RAM.

I put this issue just to notify anyone else meet this problem to know the solution. Thx.

a1ext commented 3 years ago

Hi @anaivebird, does the limit depends on presence of Labeless plug-in?

anaivebird commented 3 years ago

Not directly, but DATABASE_MEMORY = input_file_size * 4 for new file by default, since labeless load a small stub database, I think it influence the limit.

a1ext commented 9 months ago

hi @anaivebird did you check, is there a programmatic way to increase this limit?