Question: code:

```
public void test() {
    Session session = sessionFactory.openSession();
    User u = new User();
    u.setUsername("user1");
    session.delete(u);
    session.close();
}

```

I want to know why deletion does not work

Answer: 
I guess this isn't the entire block of code you are using.

This loop creates 50\*50\*10\*10\*10\*10 = 25.000.000 Fraction objects. Consider using PHP's `unset()` to clean up memory, since you are allocating memory to create objects, but you never free it up.

*editing for clarification*

When you create anything in PHP, be it variable, array, object, etc. PHP allocates memory to store it and usually, the allocated memory is freed when script execution ends.

`unset()` is the way to tell PHP, "hey, I don't need this anymore. Can you, pretty please, free up the memory it takes?". PHP takes this into consideration and frees up the memory, when its garbage collector runs. 

It is better to prevent memory exhaustion rather than feeding your script with more memory.
> 
> Allowed memory size of 134217728 bytes exhausted
> 
> 
> 

134217728 bytes = 134.218 megabytes

Can you try this?

```
ini_set('memory_limit', '140M')
/* loop code below */

```