Reputation: 149
How could this happen when reading a socket with a error ENOMEM return ? Man 2 read, I can't see any detail about this error, can someone help me. Thanks. My linux kernel 2.6.26-1-686.
Upvotes: 0
Views: 2729
Reputation: 25905
ENOMEM
is an OS error code , as defined in kern/include/kern/errno.h ,which is returned due to insufficient memory.
The name ENOMEM stands for Error NO MEMory. Its one of the error codes returned by the fork() call which means no more storage space available.In connection with sockets they are raised when there isn’t enough resources available to create a socket. The value of the error code is 12.
You can handle this error by instantly and to release all the allocated resources as soon as possible, avoiding operations requiring allocating new resources.
EDIT:
Reading from socket cause allocation for receive data buffer and they needs to be free after your requirement. Also make sure enough memory is there. It will return this error when fail in allocation of memory. See link
Upvotes: 2