Can this PHP node leak memory? I have a Drupal 7 installation that apparently leaks memory somewhere. The memory usage of nginx is going up in production until the server fails. This started basically when I added a new node with PHP content to it. My PHP code does basically this:

&lt;?php

global $user;
$token = uuid();
$uid = user_load($user-&gt;uid);
$myprofile = 'main';
$profile = profile2_load_by_user($uid, $myprofile);
$birth_date= $profile-&gt;field_birth_date['und'][0]['value'];

$conn = mysql_connect ("my.sql.server:3306/somedb", "user", "pass");
mysql_select_db("somedb", $conn);
mysql_query("INSERT INTO special_table (TOKEN, USER) VALUES ('$token','$user-&gt;name')");
mysql_close ($conn);

echo 'output some html based on birthdate..';


In addition I use memcached module. That custom DB connection that I have to open and do a single insert is not the DB of the drupal installation, that is going into a separate database. Surely not the nicest solution, but I guess that should not leak anything.

Do you see anything in this code that can possibly lead to memory leak?
It doesn't look like this is causing a memory leak as @tenken said in his comment.  However, since this is going in a node, that whole PHP snippet is stored in the database which isn't recommended.  It will take more memory to grab this code from the database, then run it.

Try sticking the code in a function in PHP file and then running that function somewhere else on the site, i.e. a custom module.  This is a good tutorial on how to do that.