in reply to undef a Module

Can you post some code as well?

Which modules are you trying to use?

What makes you suspect that the compile process is the cause of the increase in the allocated memory size?

You may benefit from looking into Mini-Tutorial: Perl's Memory Management, Memory reusability, etc. There are a lot of well written posts here on perlmonks about memory management.

You may also try looking into roles (for example: http://www.modernperlbooks.com/mt/2009/04/the-why-of-perl-roles.html, http://www.scwn.net/2009/05/duck-typing-and-roles-in-object-oriented-programming/) in order to minimize what you are compiling from the modules in question.