malloc failures in java/util/zip/Deflater (original) (raw)
Roman Kennke Roman.Kennke at Sun.COM
Wed Jul 8 18:52:31 UTC 2009
- Previous message: malloc failures in java/util/zip/Deflater
- Next message: malloc failures in java/util/zip/Deflater
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Mario,
According to the specs, malloc may return either a valid pointer that can be passed to free, or NULL, while generally NULL is considered to be a failure. Linux and Solaris, albeit non specifying it, return always a valid pointer, as far as I know
I think NULL is returned in an out of memory situation, which is very rare on modern OSes, but I think it's still possible. The right thing to do here is check for NULL and (try to) throw an OOME. Which is what is beeing done already (AFAICS). What are you trying to solve by additionally checking for len > 0?
/Roman
- Previous message: malloc failures in java/util/zip/Deflater
- Next message: malloc failures in java/util/zip/Deflater
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]