Re: [HACKERS] not checking value returned from palloc?
Mark Dilger wrote: Looking through the postgresql source code, I notice that there are many places were palloc is used but the return value is not checked to see if it is null. palloc will throw an exception if it cannot fulfill the request. Code that checks the return value for null is in fact a waste. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [HACKERS] not checking value returned from palloc?
Mark Dilger [EMAIL PROTECTED] writes: Looking through the postgresql source code, I notice that there are many places were palloc is used but the return value is not checked to see if it is null. Any place that *does* check it is incorrect (in the sense of being wasted code space, not functionally incorrect). Please read the memmgr documentation. regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [HACKERS] not checking value returned from palloc?
Peter Eisentraut wrote: Mark Dilger wrote: Looking through the postgresql source code, I notice that there are many places were palloc is used but the return value is not checked to see if it is null. palloc will throw an exception if it cannot fulfill the request. Code that checks the return value for null is in fact a waste. Interesting. So the patch should go the other way, and remove the checks that are currently in the code? ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [HACKERS] not checking value returned from palloc?
Mark Dilger wrote: Peter Eisentraut wrote: Mark Dilger wrote: Looking through the postgresql source code, I notice that there are many places were palloc is used but the return value is not checked to see if it is null. palloc will throw an exception if it cannot fulfill the request. Code that checks the return value for null is in fact a waste. Interesting. So the patch should go the other way, and remove the checks that are currently in the code? Yes, if you find any such place please submit a patch. -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [HACKERS] not checking value returned from palloc?
Alvaro Herrera wrote: Mark Dilger wrote: Peter Eisentraut wrote: Mark Dilger wrote: Looking through the postgresql source code, I notice that there are many places were palloc is used but the return value is not checked to see if it is null. palloc will throw an exception if it cannot fulfill the request. Code that checks the return value for null is in fact a waste. Interesting. So the patch should go the other way, and remove the checks that are currently in the code? Yes, if you find any such place please submit a patch. I see one in cash.c that I will remove. -- Bruce Momjian http://candle.pha.pa.us SRA OSS, Inc. http://www.sraoss.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [HACKERS] not checking value returned from palloc?
On Sun, 2006-03-19 at 17:14 -0500, Bruce Momjian wrote: I see one in cash.c that I will remove. I've already checked in a fix for that, as well as a few other places that made similar mistakes -- sorry for stepping on your toes. -Neil ---(end of broadcast)--- TIP 6: explain analyze is your friend