The table containing the saved file-descriptors<->{context, key} couples is
now dynamically malloc'd in the fd server process, hence avoiding
the memory waste which happened in other process when the table was
staticaly reserved in all processes.

Signed-off-by: Christophe Milard <[email protected]>
---
 platform/linux-generic/_fdserver.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/_fdserver.c 
b/platform/linux-generic/_fdserver.c
index bf36eb2..6ad9f6e 100644
--- a/platform/linux-generic/_fdserver.c
+++ b/platform/linux-generic/_fdserver.c
@@ -73,7 +73,7 @@ typedef struct fdentry_s {
        uint64_t key;
        int  fd;
 } fdentry_t;
-static fdentry_t fd_table[FDSERVER_MAX_ENTRIES];
+static fdentry_t *fd_table;
 static int fd_table_nb_entries;
 
 /*
@@ -622,6 +622,10 @@ int _odp_fdserver_init_global(void)
                /* TODO: pin the server on appropriate service cpu mask */
                /* when (if) we can agree on the usage of service mask  */
 
+               /* allocate the space for the file descriptor<->key table: */
+               fd_table = malloc(FDSERVER_MAX_ENTRIES * sizeof(fdentry_t));
+
+               /* wait for clients requests */
                wait_requests(sock); /* Returns when server is stopped  */
                close(sock);
                exit(0);
-- 
2.7.4

Reply via email to