my code but seems to consume all 4GB
Do you have any specific evidence that it's your program that's using all memory? The top output you've shown is just the general system statistics part, which is not necessarily related to your program only (and as the load averages hint at, a few other processes have been running recently).
Anyhow, some more info might help to narrow down on the problem. For example, does your program 'hang' (or take a long time) at some point? If so, where? (inserting a couple of debugging prints after the individual statements should suffice to tell)...
BTW, an unrelated issue: try to avoid interpolating variable data (such as $cdate etc.) into an SQL statement — use placeholders instead. Otherwise you'll risk SQL injection, should the data ever happen to come from untrusted sources...
In reply to Re: Memory Leak: Uses 3GB+
by almut
in thread Memory Leak: Uses 3GB+
by kilimanjaro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |