But, if you are sure you are not going to need the result data anymore in a script, you may call pg_free_result() with the result resource as an argument and the associated result memory will be freed.
pg_free_result() only needs to be called if you are worried about using too much memory while your script is running. All result memory will automatically be freed when the script is finished. But, if you are sure you are not going to need the result data anymore in a script, you may call pg_free_result() with the result resource as an argument and the associated result memory will be freed. Returns TRUE on success or FALSE on failure.