You loaded 25000 tables ? The INFORMATION_SCHEMA has to be taking a little beating. Why ?
All table metadata must be maintained and updated in memory for every table, column and index.
I have discussed this in the past
Please be sure you use all 25000 tables. Otherwise, holding INFORMATION_SCHEMA data on unused tables will take up memory.
BTW I have tried running
select table_name,data_length,index_length
from information_schema.tables
where table_schema='information_schema'
and engine='MEMORY';
Everything comes up 0 bytes. It's funny (and ironic) that INFORMATION_SCHEMA will not tell you what it actually consumes. You will have to measure it in a fuzzy way. I have run this
SELECT
FORMAT(m,0) MemoryBytes,
FORMAT(m/power(1024,1),2) MemoryKB,
FORMAT(m/power(1024,2),2) MemoryMB,
FORMAT(m/power(1024,3),2) MemoryGB
FROM
(
SELECT SUM(max_data_length) m
FROM information_schema.tables
WHERE table_schema='information_schema'
AND engine='MEMORY'
) A;
Use this to estimate the maximum amount of memory used for the INFORMATION_SCHEMA. Use half to estimate the average.