Index: common/Jackdmp.cpp
===================================================================
--- common/Jackdmp.cpp	(revision 2284)
+++ common/Jackdmp.cpp	(working copy)
@@ -46,7 +46,7 @@
 static char* server_name = NULL;
 static int realtime_priority = 10;
 static int do_mlock = 1;
-static unsigned int port_max = 128;
+static unsigned int port_max = 512;
 static int realtime = 0;
 static int loopback = 0;
 static int temporary = 0;
@@ -78,7 +78,7 @@
             // "               [ --unlock OR -u ]\n"
             "               [ --timeout OR -t client-timeout-in-msecs ]\n"
             "               [ --loopback OR -L loopback-port-number ]\n"
-            // "               [ --port-max OR -p maximum-number-of-ports]\n"
+            "               [ --port-max OR -p maximum-number-of-ports]\n"
             "               [ --verbose OR -v ]\n"
             "               [ --replace-registry OR -r ]\n"
             "               [ --silent OR -s ]\n"
@@ -103,10 +103,20 @@
     write(1, buf, strlen(buf));
 }
 
-static int JackStart(const char* server_name, jack_driver_desc_t* driver_desc, JSList* driver_params, int sync, int temporary, int time_out_ms, int rt, int priority, int loopback, int verbose)
+static int JackStart(const char* server_name, 
+                    jack_driver_desc_t* driver_desc, 
+                    JSList* driver_params, 
+                    int sync, 
+                    int temporary, 
+                    int time_out_ms, 
+                    int rt, 
+                    int priority, 
+                    int loopback, 
+                    int port_max, 
+                    int verbose)
 {
     jack_log("Jackdmp: sync = %ld timeout = %ld rt = %ld priority = %ld verbose = %ld ", sync, time_out_ms, rt, priority, verbose);
-    fServer = new JackServer(sync, temporary, time_out_ms, rt, priority, loopback, verbose, server_name);
+    fServer = new JackServer(sync, temporary, time_out_ms, rt, priority, loopback, port_max, verbose, server_name);
     int res = fServer->Open(driver_desc, driver_params);
     return (res < 0) ? res : fServer->Start();
 }
@@ -147,8 +157,7 @@
     jack_driver_desc_t* driver_desc;
     const char *options = "-ad:P:uvrshVRL:STFl:t:mn:p:";
     struct option long_options[] = {
-                                       { "driver", 1, 0, 'd'
-                                       },
+                                       { "driver", 1, 0, 'd'},
                                        { "verbose", 0, 0, 'v' },
                                        { "help", 0, 0, 'h' },
                                        { "port-max", 1, 0, 'p' },
@@ -352,7 +361,7 @@
     if (!realtime && client_timeout == 0)
         client_timeout = 500; /* 0.5 sec; usable when non realtime. */
 
-    int res = JackStart(server_name, driver_desc, driver_params, sync, temporary, client_timeout, realtime, realtime_priority, loopback, jack_verbose);
+    int res = JackStart(server_name, driver_desc, driver_params, sync, temporary, client_timeout, realtime, realtime_priority, loopback, port_max, jack_verbose);
     if (res < 0) {
         jack_error("Cannot start server... exit");
         JackDelete();
Index: common/JackConnectionManager.h
===================================================================
--- common/JackConnectionManager.h	(revision 2284)
+++ common/JackConnectionManager.h	(working copy)
@@ -360,10 +360,20 @@
     jack_time_t fFinishedAt;
     jack_client_state_t fStatus;
 
-    JackClientTiming(): fSignaledAt(0), fAwakeAt(0), fFinishedAt(0), fStatus(NotTriggered)
-    {}
+    JackClientTiming()
+    {
+        Init();
+    }
     ~JackClientTiming()
     {}
+    
+    void Init()
+    {
+        fSignaledAt = 0;
+        fAwakeAt = 0;
+        fFinishedAt = 0;
+        fStatus = NotTriggered;
+    }
 };
 
 /*!
@@ -385,12 +395,12 @@
 
     private:
 
-        JackFixedArray<CONNECTION_NUM> fConnection[PORT_NUM];			/*! Connection matrix: list of connected ports for a given port: needed to compute Mix buffer */
-        JackFixedArray1<PORT_NUM_FOR_CLIENT> fInputPort[CLIENT_NUM];	/*! Table of input port per refnum : to find a refnum for a given port */
-        JackFixedArray<PORT_NUM_FOR_CLIENT> fOutputPort[CLIENT_NUM];	/*! Table of output port per refnum : to find a refnum for a given port */
-        JackFixedMatrix<CLIENT_NUM> fConnectionRef;						/*! Table of port connections by (refnum , refnum) */
-        JackActivationCount fInputCounter[CLIENT_NUM];					/*! Activation counter per refnum */
-        JackLoopFeedback<CONNECTION_NUM> fLoopFeedback;					/*! Loop feedback connections */
+        JackFixedArray<CONNECTION_NUM_FOR_PORT> fConnection[PORT_NUM_MAX];  /*! Connection matrix: list of connected ports for a given port: needed to compute Mix buffer */
+        JackFixedArray1<PORT_NUM_FOR_CLIENT> fInputPort[CLIENT_NUM];        /*! Table of input port per refnum : to find a refnum for a given port */
+        JackFixedArray<PORT_NUM_FOR_CLIENT> fOutputPort[CLIENT_NUM];        /*! Table of output port per refnum : to find a refnum for a given port */
+        JackFixedMatrix<CLIENT_NUM> fConnectionRef;                         /*! Table of port connections by (refnum , refnum) */
+        JackActivationCount fInputCounter[CLIENT_NUM];                      /*! Activation counter per refnum */
+        JackLoopFeedback<CONNECTION_NUM_FOR_PORT> fLoopFeedback;            /*! Loop feedback connections */
 
         bool IsLoopPathAux(int ref1, int ref2) const;
 
@@ -398,7 +408,7 @@
 
         JackConnectionManager();
         ~JackConnectionManager();
-
+   
         // Connections management
         int Connect(jack_port_id_t port_src, jack_port_id_t port_dst);
         int Disconnect(jack_port_id_t port_src, jack_port_id_t port_dst);
Index: common/JackEngine.cpp
===================================================================
--- common/JackEngine.cpp	(revision 2284)
+++ common/JackEngine.cpp	(working copy)
@@ -738,18 +738,18 @@
 
     if (dst == ALL_PORTS) {
 
-        jack_int_t connections[CONNECTION_NUM];
+        jack_int_t connections[CONNECTION_NUM_FOR_PORT];
         fGraphManager->GetConnections(src, connections);
 
         // Notifications
         JackPort* port = fGraphManager->GetPort(src);
         if (port->GetFlags() & JackPortIsOutput) {
-            for (int i = 0; (i < CONNECTION_NUM) && (connections[i] != EMPTY); i++) {
+            for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && (connections[i] != EMPTY); i++) {
                 jack_log("NotifyPortConnect src = %ld dst = %ld false", src, connections[i]);
                 NotifyPortConnect(src, connections[i], false);
             }
         } else {
-            for (int i = 0; (i < CONNECTION_NUM) && (connections[i] != EMPTY); i++) {
+            for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && (connections[i] != EMPTY); i++) {
                 jack_log("NotifyPortConnect src = %ld dst = %ld false", connections[i], src);
                 NotifyPortConnect(connections[i], src, false);
             }
Index: common/JackServer.h
===================================================================
--- common/JackServer.h	(revision 2284)
+++ common/JackServer.h	(working copy)
@@ -61,7 +61,7 @@
 
     public:
 
-        JackServer(bool sync, bool temporary, long timeout, bool rt, long priority, long loopback, bool verbose, const char* server_name);
+        JackServer(bool sync, bool temporary, long timeout, bool rt, long priority, long loopback, long port_max, bool verbose, const char* server_name);
         virtual ~JackServer();
 
         int Open(jack_driver_desc_t* driver_desc, JSList* driver_params);
Index: common/JackClient.cpp
===================================================================
--- common/JackClient.cpp	(revision 2284)
+++ common/JackClient.cpp	(working copy)
@@ -598,11 +598,11 @@
 }
 
 /* Call the server if the client is active, otherwise keeps the arguments */
-int JackClient::SetSyncCallback(JackSyncCallback sync_callback, void* arg)
+int JackClient::SetSyncCallback(JackSyncCallback callback, void* arg)
 {
     GetClientControl()->fTransportSync = (fSync != NULL);
     fSyncArg = arg;
-    fSync = sync_callback;
+    fSync = callback;
     return 0;
 }
 
@@ -612,14 +612,14 @@
     return 0;
 }
 
-int JackClient::SetTimebaseCallback(int conditional, JackTimebaseCallback timebase_callback, void* arg)
+int JackClient::SetTimebaseCallback(int conditional, JackTimebaseCallback callback, void* arg)
 {
     int result = -1;
     fChannel->SetTimebaseCallback(GetClientControl()->fRefNum, conditional, &result);
     jack_log("SetTimebaseCallback result = %ld", result);
     if (result == 0) {
         GetClientControl()->fTransportTimebase = true;
-        fTimebase = timebase_callback;
+        fTimebase = callback;
         fTimebaseArg = arg;
     } else {
         fTimebase = NULL;
@@ -868,7 +868,7 @@
     }
 }
 
-int JackClient::SetProcessThread(JackThreadCallback fun, void *arg)
+int JackClient::SetProcessThread(JackThreadCallback callback, void *arg)
 {
     if (IsActive()) {
         jack_error("You cannot set callbacks on an active client");
@@ -877,7 +877,7 @@
         jack_error ("A process callback has already been setup, both models cannot be used at the same time!");
         return -1;
     } else {
-        fThreadFun = fun;
+        fThreadFun = callback;
         fThreadFunArg = arg;
         return 0;
     }
Index: common/JackServerGlobals.h
===================================================================
--- common/JackServerGlobals.h	(revision 2284)
+++ common/JackServerGlobals.h	(working copy)
@@ -53,6 +53,7 @@
                      int rt,
                      int priority,
                      int loopback,
+                     int port_max,
                      int verbose);
     static int Stop();
     static int Delete();
Index: common/JackAudioDriver.h
===================================================================
--- common/JackAudioDriver.h	(revision 2284)
+++ common/JackAudioDriver.h	(working copy)
@@ -40,9 +40,9 @@
 
         // static tables since the actual number of ports may be changed by the real driver
         // thus dynamic allocation is more difficult to handle
-        jack_port_id_t fCapturePortList[PORT_NUM];
-        jack_port_id_t fPlaybackPortList[PORT_NUM];
-        jack_port_id_t fMonitorPortList[PORT_NUM];
+        jack_port_id_t fCapturePortList[DRIVER_PORT_NUM];
+        jack_port_id_t fPlaybackPortList[DRIVER_PORT_NUM];
+        jack_port_id_t fMonitorPortList[DRIVER_PORT_NUM];
 
         bool fWithMonitorPorts;
 
Index: common/JackConnectionManager.cpp
===================================================================
--- common/JackConnectionManager.cpp	(revision 2284)
+++ common/JackConnectionManager.cpp	(working copy)
@@ -29,15 +29,13 @@
 JackConnectionManager::JackConnectionManager()
 {
     int i;
-    jack_log("JackConnectionManager::InitConnections size = %ld ", sizeof(JackConnectionManager));
 
-    for (i = 0; i < PORT_NUM; i++) {
+    for (i = 0; i < PORT_NUM_MAX; i++) {
         fConnection[i].Init();
     }
 
     fLoopFeedback.Init();
 
-    jack_log("JackConnectionManager::InitClients");
     for (i = 0; i < CLIENT_NUM; i++) {
         InitRefNum(i);
     }
@@ -136,7 +134,7 @@
 
 jack_port_id_t JackConnectionManager::GetPort(jack_port_id_t port_index, int connection) const
 {
-    assert(connection < CONNECTION_NUM);
+    assert(connection < CONNECTION_NUM_FOR_PORT);
     return (jack_port_id_t)fConnection[port_index].GetItem(connection);
 }
 
Index: common/JackGraphManager.h
===================================================================
--- common/JackGraphManager.h	(revision 2284)
+++ common/JackGraphManager.h	(working copy)
@@ -39,9 +39,11 @@
 
     private:
 
-        JackPort fPortArray[];
+        uint32_t fPortMax;
         JackClientTiming fClientTiming[CLIENT_NUM];
+        JackPort fPortArray[0];    // The actual size depends of port_max, it will be dynamically computed and allocated using "placement" new
 
+        void AssertPort(jack_port_id_t port_index);
         jack_port_id_t AllocatePortAux(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
         void GetConnectionsAux(JackConnectionManager* manager, const char** res, jack_port_id_t port_index);
         void GetPortsAux(const char** matching_ports, const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
@@ -51,8 +53,7 @@
 
     public:
 
-        JackGraphManager()
-        {}
+        JackGraphManager(int port_max);        
         ~JackGraphManager()
         {}
 
@@ -65,6 +66,7 @@
         void GetOutputPorts(int refnum, jack_int_t* res);
         void RemoveAllPorts(int refnum);
         void DisconnectAllPorts(int refnum);
+        bool CheckPort(jack_port_id_t port_index);
 
         JackPort* GetPort(jack_port_id_t index);
         jack_port_id_t GetPort(const char* name);
@@ -115,6 +117,9 @@
 
         void Save(JackConnectionManager* dst);
         void Restore(JackConnectionManager* src);
+        
+        static JackGraphManager* Allocate(int port_max);
+        static void Destroy(JackGraphManager* manager);
 
 };
 
Index: common/JackServer.cpp
===================================================================
--- common/JackServer.cpp	(revision 2284)
+++ common/JackServer.cpp	(working copy)
@@ -42,16 +42,12 @@
 
 JackServer* JackServer::fInstance = NULL;
 
-JackServer::JackServer(bool sync, bool temporary, long timeout, bool rt, long priority, long loopback, bool verbose, const char* server_name)
+JackServer::JackServer(bool sync, bool temporary, long timeout, bool rt, long priority, long loopback, long port_max, bool verbose, const char* server_name)
 {
     JackGlobals::InitServer();
     for (int i = 0; i < CLIENT_NUM; i++)
         fSynchroTable[i] = JackGlobals::MakeSynchro();
-    
-    // Use "placement" new for graph manager
-    void* shared_mem = JackShmMem::operator new(PORT_NUM * 1*sizeof(JackPort) + sizeof(JackGraphManager));
-    fGraphManager = new(shared_mem) JackGraphManager();
-    
+    fGraphManager = JackGraphManager::Allocate(port_max);
     fEngineControl = new JackEngineControl(sync, temporary, timeout, rt, priority, verbose, server_name);
     fEngine = new JackLockedEngine(new JackEngine(fGraphManager, fSynchroTable, fEngineControl));
     fFreewheelDriver = new JackThreadedDriver(new JackFreewheelDriver("freewheel", fEngine, fSynchroTable));
@@ -69,7 +65,7 @@
 {
     for (int i = 0; i < CLIENT_NUM; i++)
         delete fSynchroTable[i];
-    delete fGraphManager;
+    JackGraphManager::Destroy(fGraphManager);    
     delete fAudioDriver;
     delete fFreewheelDriver;
     delete fLoopbackDriver;
Index: common/JackAPI.cpp
===================================================================
--- common/JackAPI.cpp	(revision 2284)
+++ common/JackAPI.cpp	(working copy)
@@ -236,11 +236,6 @@
 }
 #endif
 
-static inline bool CheckPort(jack_port_id_t port_index)
-{
-    return (port_index > 0 && port_index < PORT_NUM);
-}
-
 static inline bool CheckBufferSize(jack_nframes_t buffer_size)
 {
     return (buffer_size <= BUFFER_SIZE_MAX);
@@ -282,12 +277,12 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_get_buffer called with an incorrect port %ld", myport);
         return NULL;
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetBuffer(myport, frames) : NULL);
+        return manager->GetBuffer(myport, frames);
     }
 }
 
@@ -297,12 +292,12 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_name called with an incorrect port %ld", myport);
         return NULL;
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetPort(myport)->GetName() : NULL);
+        return manager->GetPort(myport)->GetName();
     }
 }
 
@@ -312,12 +307,12 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_short_name called with an incorrect port %ld", myport);
         return NULL;
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetPort(myport)->GetShortName() : NULL);
+        return manager->GetPort(myport)->GetShortName();
     }
 }
 
@@ -327,12 +322,12 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_flags called with an incorrect port %ld", myport);
         return -1;
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetPort(myport)->GetFlags() : -1);
+        return manager->GetPort(myport)->GetFlags();
     }
 }
 
@@ -342,12 +337,12 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_flags called an incorrect port %ld", myport);
         return NULL;
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetPort(myport)->GetType() : NULL);
+        return manager->GetPort(myport)->GetType();
     }
 }
 
@@ -357,13 +352,13 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_connected called with an incorrect port %ld", myport);
         return -1;
     } else {
         WaitGraphChange();
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetConnectionsNum(myport) : -1);
+        return manager->GetConnectionsNum(myport);
     }
 }
 
@@ -373,7 +368,8 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t src = (jack_port_id_t)port;
-    if (!CheckPort(src)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(src)) {
         jack_error("jack_port_connected_to called with an incorrect port %ld", src);
         return -1;
     } else if (port_name == NULL) {
@@ -381,8 +377,7 @@
         return -1;
     } else {
         WaitGraphChange();
-        JackGraphManager* manager = GetGraphManager();
-        jack_port_id_t dst = (manager ? manager->GetPort(port_name) : NO_PORT);
+        jack_port_id_t dst = manager->GetPort(port_name);
         if (dst == NO_PORT) {
             jack_error("Unknown destination port port_name = %s", port_name);
             return 0;
@@ -398,17 +393,17 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t mysrc = (jack_port_id_t)src;
-    if (!CheckPort(mysrc)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(mysrc)) {
         jack_error("jack_port_tie called with a NULL src port");
         return -1;
     }
     jack_port_id_t mydst = (jack_port_id_t)dst;
-    if (!CheckPort(mydst)) {
+    if (!manager->CheckPort(mydst)) {
         jack_error("jack_port_tie called with a NULL dst port");
         return -1;
     }
-    JackGraphManager* manager = GetGraphManager();
-    if (manager && manager->GetPort(mysrc)->GetRefNum() != manager->GetPort(mydst)->GetRefNum()) {
+    if (manager->GetPort(mysrc)->GetRefNum() != manager->GetPort(mydst)->GetRefNum()) {
         jack_error("jack_port_tie called with ports not belonging to the same client");
         return -1;
     } else {
@@ -422,12 +417,12 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_untie called with an incorrect port %ld", myport);
         return -1;
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetPort(myport)->UnTie() : -1);
+        return manager->GetPort(myport)->UnTie();
     }
 }
 
@@ -437,13 +432,13 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_get_latency called with an incorrect port %ld", myport);
         return 0;
     } else {
         WaitGraphChange();
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetPort(myport)->GetLatency() : 0);
+        return manager->GetPort(myport)->GetLatency();
     }
 }
 
@@ -453,12 +448,11 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_set_latency called with an incorrect port %ld", myport);
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        if (manager)
-            manager->GetPort(myport)->SetLatency(frames);
+        manager->GetPort(myport)->SetLatency(frames);
     }
 }
 
@@ -470,16 +464,16 @@
 
     JackClient* client = (JackClient*)ext_client;
     jack_port_id_t myport = (jack_port_id_t)port;
+    JackGraphManager* manager = GetGraphManager();
     if (client == NULL) {
         jack_error("jack_recompute_total_latencies called with a NULL client");
         return -1;
-    } else if (!CheckPort(myport)) {
+    } else if (!manager->CheckPort(myport)) {
         jack_error("jack_recompute_total_latencies called with a NULL port");
         return -1;
     } else {
         WaitGraphChange();
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->ComputeTotalLatency(myport) : -1);
+        return manager->ComputeTotalLatency(myport);
     }
 }
 
@@ -496,7 +490,7 @@
     } else {
         WaitGraphChange();
         JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->ComputeTotalLatencies() : -1);
+        return manager->ComputeTotalLatencies();
     }
 }
 
@@ -510,15 +504,15 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_set_name called with an incorrect port %ld", myport);
         return -1;
     } else if (name == NULL) {
         jack_error("jack_port_set_name called with a NULL port name");
         return -1;
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetPort(myport)->SetName(name) : -1);
+       return manager->GetPort(myport)->SetName(name);
     }
 }
 
@@ -528,15 +522,15 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_set_alias called with an incorrect port %ld", myport);
         return -1;
     } else if (name == NULL) {
         jack_error("jack_port_set_alias called with a NULL port name");
         return -1;
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetPort(myport)->SetAlias(name) : -1);
+        return manager->GetPort(myport)->SetAlias(name);
     }
 }
 
@@ -546,15 +540,15 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_unset_alias called with an incorrect port %ld", myport);
         return -1;
     } else if (name == NULL) {
         jack_error("jack_port_unset_alias called with a NULL port name");
         return -1;
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetPort(myport)->UnsetAlias(name) : -1);
+        return manager->GetPort(myport)->UnsetAlias(name);
     }
 }
 
@@ -564,12 +558,12 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_get_aliases called with an incorrect port %ld", myport);
         return -1;
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetPort(myport)->GetAliases(aliases) : -1);
+        return manager->GetPort(myport)->GetAliases(aliases);
     }
 }
 
@@ -579,12 +573,12 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_request_monitor called with an incorrect port %ld", myport);
         return -1;
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->RequestMonitor(myport, onoff) : -1);
+        return manager->RequestMonitor(myport, onoff);
     }
 }
 
@@ -599,10 +593,8 @@
         return -1;
     } else {
         JackGraphManager* manager = GetGraphManager();
-        if (!manager)
-            return -1;
         jack_port_id_t myport = manager->GetPort(port_name);
-        if (!CheckPort(myport)) {
+        if (!manager->CheckPort(myport)) {
             jack_error("jack_port_request_monitor_by_name called with an incorrect port %s", port_name);
             return -1;
         } else {
@@ -617,12 +609,12 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_ensure_monitor called with an incorrect port %ld", myport);
         return -1;
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetPort(myport)->EnsureMonitor(onoff) : -1);
+        return manager->GetPort(myport)->EnsureMonitor(onoff);
     }
 }
 
@@ -632,12 +624,12 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_monitoring_input called with an incorrect port %ld", myport);
         return -1;
     } else {
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetPort(myport)->MonitoringInput() : -1);
+        return manager->GetPort(myport)->MonitoringInput();
     }
 }
 
@@ -948,12 +940,13 @@
     JackLibGlobals::CheckContext();
 #endif
     JackClient* client = (JackClient*)ext_client;
+    JackGraphManager* manager = GetGraphManager();
     if (client == NULL) {
         jack_error("jack_port_unregister called with a NULL client");
         return -1;
     }
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_unregister called with an incorrect port %ld", myport);
         return -1;
     }
@@ -966,12 +959,13 @@
     JackLibGlobals::CheckContext();
 #endif
     JackClient* client = (JackClient*)ext_client;
+    JackGraphManager* manager = GetGraphManager();
     if (client == NULL) {
         jack_error("jack_port_is_mine called with a NULL client");
         return -1;
     }
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_is_mine called with an incorrect port %ld", myport);
         return -1;
     }
@@ -984,13 +978,13 @@
     JackLibGlobals::CheckContext();
 #endif
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_get_connections called with an incorrect port %ld", myport);
         return NULL;
     } else {
         WaitGraphChange();
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetConnections(myport) : NULL);
+        return manager->GetConnections(myport);
     }
 }
 
@@ -1001,19 +995,19 @@
     JackLibGlobals::CheckContext();
 #endif
     JackClient* client = (JackClient*)ext_client;
+    JackGraphManager* manager = GetGraphManager();
     if (client == NULL) {
         jack_error("jack_port_get_all_connections called with a NULL client");
         return NULL;
     }
 
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_get_all_connections called with an incorrect port %ld", myport);
         return NULL;
     } else {
         WaitGraphChange();
-        JackGraphManager* manager = GetGraphManager();
-        return (manager ? manager->GetConnections(myport) : NULL);
+        return manager->GetConnections(myport);
     }
 }
 
@@ -1029,18 +1023,14 @@
     }
 
     jack_port_id_t myport = (jack_port_id_t)port;
-    if (!CheckPort(myport)) {
+    JackGraphManager* manager = GetGraphManager();
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_get_total_latency called with an incorrect port %ld", myport);
         return 0;
     } else {
         WaitGraphChange();
-        JackGraphManager* manager = GetGraphManager();
-        if (manager) {
-            manager->ComputeTotalLatency(myport);
-            return manager->GetPort(myport)->GetTotalLatency();
-        } else {
-            return 0;
-        }
+        manager->ComputeTotalLatency(myport);
+        return manager->GetPort(myport)->GetTotalLatency();
     }
 }
 
@@ -1084,12 +1074,13 @@
     JackLibGlobals::CheckContext();
 #endif
     JackClient* client = (JackClient*)ext_client;
+    JackGraphManager* manager = GetGraphManager();
     if (client == NULL) {
         jack_error("jack_port_disconnect called with a NULL client");
         return -1;
     }
     jack_port_id_t myport = (jack_port_id_t)src;
-    if (!CheckPort(myport)) {
+    if (!manager->CheckPort(myport)) {
         jack_error("jack_port_disconnect called with an incorrect port %ld", myport);
         return -1;
     }
@@ -1137,7 +1128,7 @@
         return NULL;
     }
     JackGraphManager* manager = GetGraphManager();
-    return (manager ? manager->GetPorts(port_name_pattern, type_name_pattern, flags) : NULL);
+    return manager->GetPorts(port_name_pattern, type_name_pattern, flags);
 }
 
 EXPORT jack_port_t* jack_port_by_name(jack_client_t* ext_client, const char* portname)
@@ -1156,8 +1147,6 @@
         return NULL;
     } else {
         JackGraphManager* manager = GetGraphManager();
-        if (!manager)
-            return NULL;
         int res = manager->GetPort(portname); // returns a port index at least > 1
         return (res == NO_PORT) ? NULL : (jack_port_t*)res;
     }
Index: common/JackServerGlobals.cpp
===================================================================
--- common/JackServerGlobals.cpp	(revision 2284)
+++ common/JackServerGlobals.cpp	(working copy)
@@ -44,10 +44,11 @@
                              int rt,
                              int priority,
                              int loopback,
+                             int port_max,
                              int verbose)
 {
     jack_log("Jackdmp: sync = %ld timeout = %ld rt = %ld priority = %ld verbose = %ld ", sync, time_out_ms, rt, priority, verbose);
-    fServer = new JackServer(sync, temporary, time_out_ms, rt, priority, loopback, verbose, server_name);
+    fServer = new JackServer(sync, temporary, time_out_ms, rt, priority, loopback, port_max, verbose, server_name);
     int res = fServer->Open(driver_desc, driver_params);
     return (res < 0) ? res : fServer->Start();
 }
@@ -84,7 +85,7 @@
         int realtime_priority = 10;
         int verbose_aux = 0;
         int do_mlock = 1;
-        unsigned int port_max = 128;
+        unsigned int port_max = 512;
         int loopback = 0;
         int do_unlock = 0;
         int temporary = 0;
@@ -92,8 +93,7 @@
         jack_driver_desc_t* driver_desc;
         const char *options = "-ad:P:uvshVRL:STFl:t:mn:p:";
         static struct option long_options[] = {
-                                                  { "driver", 1, 0, 'd'
-                                                  },
+                                                  { "driver", 1, 0, 'd'},
                                                   { "verbose", 0, 0, 'v' },
                                                   { "help", 0, 0, 'h' },
                                                   { "port-max", 1, 0, 'p' },
@@ -182,15 +182,15 @@
                 case 'n':
                     server_name = optarg;
                     break;
+                    
+                case 'p':
+                    port_max = (unsigned int) atol (optarg);
+                    break;
 
                 case 'm':
                     do_mlock = 0;
                     break;
 
-                case 'p':
-                    port_max = (unsigned int)atol(optarg);
-                    break;
-
                 case 'P':
                     realtime_priority = atoi(optarg);
                     break;
@@ -292,7 +292,7 @@
             free(argv[i]);
         }
 
-        int res = Start(server_name, driver_desc, driver_params, sync, temporary, client_timeout, realtime, realtime_priority, loopback, verbose_aux);
+        int res = Start(server_name, driver_desc, driver_params, sync, temporary, client_timeout, realtime, realtime_priority, loopback, port_max, verbose_aux);
         if (res < 0) {
             jack_error("Cannot start server... exit");
             Delete();
Index: common/JackPort.h
===================================================================
--- common/JackPort.h	(revision 2284)
+++ common/JackPort.h	(working copy)
@@ -76,6 +76,7 @@
         JackPort();
         virtual ~JackPort();
 
+        void Init();
         bool Allocate(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
         void Release();
         const char* GetName() const;
Index: common/JackShmMem.h
===================================================================
--- common/JackShmMem.h	(revision 2284)
+++ common/JackShmMem.h	(working copy)
@@ -107,6 +107,7 @@
         void* operator new(size_t size);
         void* operator new(size_t size, void* memory);
         void operator delete(void* p, size_t size);
+        void operator delete(void* p);
 
         JackShmMem()
         {
Index: common/JackGraphManager.cpp
===================================================================
--- common/JackGraphManager.cpp	(revision 2284)
+++ common/JackGraphManager.cpp	(working copy)
@@ -33,14 +33,37 @@
     return (a < b) ? b : a;
 }
 
-static void AssertPort(jack_port_id_t port_index)
+/*
+    Use "placement" new for graph manager, using the idea exposed here: 
+    http://www.devmaster.net/forums/showthread.php?t=11310
+*/
+ 
+JackGraphManager* JackGraphManager::Allocate(int port_max)
 {
-    if (port_index >= PORT_NUM) {
+    void* shared_ptr = JackShmMem::operator new(sizeof(JackGraphManager) + port_max * sizeof(JackPort));
+    return new(shared_ptr) JackGraphManager(port_max);
+}
+
+void JackGraphManager::Destroy(JackGraphManager* manager)
+{
+    // "Placement" new was used
+    manager->~JackGraphManager();
+    JackShmMem::operator delete(manager);
+}
+
+void JackGraphManager::AssertPort(jack_port_id_t port_index)
+{
+    if (port_index >= fPortMax) {
         jack_log("JackGraphManager::AssertPort port_index = %ld", port_index);
-        assert(port_index < PORT_NUM);
+        assert(port_index < fPortMax);
     }
 }
 
+bool JackGraphManager::CheckPort(jack_port_id_t port_index)
+{
+    return (port_index > 0 && port_index < fPortMax);
+}
+
 static void AssertBufferSize(jack_nframes_t buffer_size)
 {
     if (buffer_size > BUFFER_SIZE_MAX) {
@@ -49,6 +72,17 @@
     }
 }
 
+JackGraphManager::JackGraphManager(int port_max) 
+{
+    int i;
+    assert(port_max <= PORT_NUM_MAX);
+    
+    for (i = 0; i < port_max; i++)
+        fPortArray[i].Init();
+        
+    fPortMax = port_max;
+}
+
 JackPort* JackGraphManager::GetPort(jack_port_id_t port_index)
 {
     AssertPort(port_index);
@@ -150,10 +184,10 @@
 
     JackConnectionManager* manager = ReadCurrentState();
     JackPort* port = GetPort(port_index);
-
+  
     if (!port->IsUsed()) {
         // This happens when a port has just been unregistered and is still used by the RT code.
-        jack_log("JackGraphManager::GetBuffer : port = %ld is released state", port_index);
+        jack_log("JackGraphManager::GetBuffer port = %ld is released state", port_index);
         return GetBuffer(0); // port_index 0 is not used
     }
 
@@ -174,11 +208,11 @@
     } else {  // Multiple connections
 
         const jack_int_t* connections = manager->GetConnections(port_index);
-        void* buffers[CONNECTION_NUM];
+        void* buffers[CONNECTION_NUM_FOR_PORT];
         jack_port_id_t src_index;
         int i;
 
-        for (i = 0; (i < CONNECTION_NUM) && ((src_index = connections[i]) != EMPTY); i++) {
+        for (i = 0; (i < CONNECTION_NUM_FOR_PORT) && ((src_index = connections[i]) != EMPTY); i++) {
             AssertPort(src_index);
             buffers[i] = GetBuffer(src_index, buffer_size);
         }
@@ -209,7 +243,7 @@
     const jack_int_t* connections = ReadCurrentState()->GetConnections(port_index);
     if ((port->fFlags & JackPortIsOutput) == 0) { // ?? Taken from jack, why not (port->fFlags  & JackPortIsInput) ?
         jack_port_id_t src_index;
-        for (int i = 0; (i < CONNECTION_NUM) && ((src_index = connections[i]) != EMPTY); i++) {
+        for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && ((src_index = connections[i]) != EMPTY); i++) {
             // XXX much worse things will happen if there is a feedback loop !!!
             RequestMonitor(src_index, onoff);
         }
@@ -228,7 +262,7 @@
     if (hop_count > 8)
         return GetPort(port_index)->GetLatency();
 
-    for (int i = 0; (i < CONNECTION_NUM) && ((dst_index = connections[i]) != EMPTY); i++) {
+    for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && ((dst_index = connections[i]) != EMPTY); i++) {
         if (src_port_index != dst_index) {
             AssertPort(dst_index);
             JackPort* dst_port = GetPort(dst_index);
@@ -264,7 +298,7 @@
 int JackGraphManager::ComputeTotalLatencies()
 {
     jack_port_id_t port_index;
-    for (port_index = FIRST_AVAILABLE_PORT; port_index < PORT_NUM; port_index++) {
+    for (port_index = FIRST_AVAILABLE_PORT; port_index < fPortMax; port_index++) {
         JackPort* port = GetPort(port_index);
         if (port->IsUsed())
             ComputeTotalLatency(port_index);
@@ -278,7 +312,7 @@
     jack_log("JackGraphManager::SetBufferSize size = %ld", buffer_size);
 
     jack_port_id_t port_index;
-    for (port_index = FIRST_AVAILABLE_PORT; port_index < PORT_NUM; port_index++) {
+    for (port_index = FIRST_AVAILABLE_PORT; port_index < fPortMax; port_index++) {
         JackPort* port = GetPort(port_index);
         if (port->IsUsed())
             port->ClearBuffer(buffer_size);
@@ -291,7 +325,7 @@
     jack_port_id_t port_index;
 
     // Available ports start at FIRST_AVAILABLE_PORT (= 1), otherwise a port_index of 0 is "seen" as a NULL port by the external API...
-    for (port_index = FIRST_AVAILABLE_PORT; port_index < PORT_NUM; port_index++) {
+    for (port_index = FIRST_AVAILABLE_PORT; port_index < fPortMax; port_index++) {
         JackPort* port = GetPort(port_index);
         if (!port->IsUsed()) {
             jack_log("JackGraphManager::AllocatePortAux port_index = %ld name = %s type = %s", port_index, port_name, port_type);
@@ -301,7 +335,7 @@
         }
     }
 
-    return (port_index < PORT_NUM) ? port_index : NO_PORT;
+    return (port_index < fPortMax) ? port_index : NO_PORT;
 }
 
 // Server
@@ -416,7 +450,7 @@
     jack_log("JackGraphManager::DisconnectAllInput port_index = %ld ", port_index);
     JackConnectionManager* manager = WriteNextStateStart();
 
-    for (int i = 0; i < PORT_NUM; i++) {
+    for (int i = 0; i < fPortMax; i++) {
         if (manager->IsConnected(i, port_index)) {
             jack_log("JackGraphManager::Disconnect i = %ld  port_index = %ld", i, port_index);
             Disconnect(i, port_index);
@@ -457,7 +491,7 @@
 {
     JackConnectionManager* manager = WriteNextStateStart();
     const jack_int_t* connections = manager->GetConnections(port_index);
-    memcpy(res, connections, sizeof(jack_int_t) * CONNECTION_NUM);
+    memcpy(res, connections, sizeof(jack_int_t) * CONNECTION_NUM_FOR_PORT);
     WriteNextStateStop();
 }
 
@@ -655,7 +689,7 @@
 // Client : port array
 jack_port_id_t JackGraphManager::GetPort(const char* name)
 {
-    for (int i = 0; i < PORT_NUM; i++) {
+    for (int i = 0; i < fPortMax; i++) {
         JackPort* port = GetPort(i);
         if (port->IsUsed() && port->NameEquals(name))
             return i;
@@ -675,9 +709,9 @@
     int i;
     
     // Cleanup connection array
-    memset(res, 0, sizeof(char*) * CONNECTION_NUM);
+    memset(res, 0, sizeof(char*) * CONNECTION_NUM_FOR_PORT);
 
-    for (i = 0; (i < CONNECTION_NUM) && ((index = connections[i]) != EMPTY); i++) {
+    for (i = 0; (i < CONNECTION_NUM_FOR_PORT) && ((index = connections[i]) != EMPTY); i++) {
         JackPort* port = GetPort(index);
         res[i] = port->fName;
     }
@@ -694,7 +728,7 @@
 // Client
 const char** JackGraphManager::GetConnections(jack_port_id_t port_index)
 {
-    const char** res = (const char**)malloc(sizeof(char*) * CONNECTION_NUM);
+    const char** res = (const char**)malloc(sizeof(char*) * CONNECTION_NUM_FOR_PORT);
     UInt16 cur_index, next_index;
 
     do {
@@ -725,9 +759,9 @@
     }
 
     // Cleanup port array
-    memset(matching_ports, 0, sizeof(char*) * PORT_NUM);
+    memset(matching_ports, 0, sizeof(char*) * fPortMax);
 
-    for (int i = 0; i < PORT_NUM; i++) {
+    for (int i = 0; i < fPortMax; i++) {
         bool matching = true;
         JackPort* port = GetPort(i);
 
@@ -774,7 +808,7 @@
 */
 const char** JackGraphManager::GetPorts(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags)
 {
-    const char** res = (const char**)malloc(sizeof(char*) * PORT_NUM);
+    const char** res = (const char**)malloc(sizeof(char*) * fPortMax);
     UInt16 cur_index, next_index;
  
     do {
Index: common/JackConstants.h
===================================================================
--- common/JackConstants.h	(revision 2284)
+++ common/JackConstants.h	(working copy)
@@ -35,10 +35,12 @@
 #define JACK_CLIENT_NAME_SIZE 64
 
 #define FIRST_AVAILABLE_PORT 1
-#define PORT_NUM 512
+
+#define DRIVER_PORT_NUM 128                        
+#define PORT_NUM_MAX 2048           // The "max" value for ports used in connection manager, although port number in graph manager is dynamic
 #define PORT_NUM_FOR_CLIENT 256
 
-#define CONNECTION_NUM 256
+#define CONNECTION_NUM_FOR_PORT 256
 
 #define CLIENT_NUM 64
 
Index: common/JackPort.cpp
===================================================================
--- common/JackPort.cpp	(revision 2284)
+++ common/JackPort.cpp	(working copy)
@@ -29,12 +29,25 @@
 {
 
 JackPort::JackPort()
-        : fFlags(JackPortIsInput), fRefNum( -1), fLatency(0), fTotalLatency(0), fMonitorRequests(0), fInUse(false), fTied(NO_PORT)
-{}
+{
+    Init();
+}
 
 JackPort::~JackPort()
 {}
 
+void JackPort::Init()
+{
+    fTypeId = 0;
+    fFlags = JackPortIsInput;
+    fRefNum = -1;
+    fLatency = 0;
+    fTotalLatency = 0;
+    fMonitorRequests = 0;
+    fInUse = false;
+    fTied = NO_PORT;
+}
+
 bool JackPort::Allocate(int refnum, const char* port_name, const char* port_type, JackPortFlags flags)
 {
     int id = GetPortTypeId(port_type);
Index: common/JackShmMem.cpp
===================================================================
--- common/JackShmMem.cpp	(revision 2284)
+++ common/JackShmMem.cpp	(working copy)
@@ -82,6 +82,11 @@
     jack_destroy_shm(&info);
 }
 
+void JackShmMem::operator delete(void* p)
+{
+    operator delete(p, 0);
+}
+
 void LockMemoryImp(void* ptr, size_t size)
 {
     if (CHECK_MLOCK(ptr, size)) {
Index: windows/JackdmpWIN32.cpp
===================================================================
--- windows/JackdmpWIN32.cpp	(revision 2284)
+++ windows/JackdmpWIN32.cpp	(working copy)
@@ -36,7 +36,7 @@
 static char *server_name = "default";
 static int realtime_priority = 10;
 static int do_mlock = 1;
-static unsigned int port_max = 128;
+static unsigned int port_max = 512;
 static int realtime = 0;
 static int loopback = 0;
 static int temporary = 0;
@@ -77,7 +77,7 @@
              // "               [ --unlock OR -u ]\n"
              "               [ --timeout OR -t client-timeout-in-msecs ]\n"
              "               [ --loopback OR -L loopback-port-number ]\n"
-             // "               [ --port-max OR -p maximum-number-of-ports]\n"
+             "               [ --port-max OR -p maximum-number-of-ports]\n"
              "               [ --verbose OR -v ]\n"
              "               [ --replace-registry OR -r ]\n"
              "               [ --silent OR -s ]\n"
@@ -89,10 +89,10 @@
              "             to display options for each driver\n\n");
 }
 
-static int JackStart(jack_driver_desc_t* driver_desc, JSList* driver_params, int sync, int time_out_ms, int rt, int priority, int loopback, int verbose, const char* server_name)
+static int JackStart(jack_driver_desc_t* driver_desc, JSList* driver_params, int sync, int time_out_ms, int rt, int priority, int loopback, int port_max, int verbose, const char* server_name)
 {
     printf("Jackdmp: sync = %ld timeout = %ld rt = %ld priority = %ld verbose = %ld \n", sync, time_out_ms, rt, priority, verbose);
-    fServer = new JackServer(sync, temporary, time_out_ms, rt, priority, loopback, verbose, server_name);
+    fServer = new JackServer(sync, temporary, time_out_ms, rt, priority, loopback, port_max, verbose, server_name);
     int res = fServer->Open(driver_desc, driver_params);
     return (res < 0) ? res : fServer->Start();
 }
@@ -254,8 +254,7 @@
     jack_driver_desc_t * driver_desc;
     const char *options = "-ad:P:uvshVRL:STFl:t:mn:p:";
     struct option long_options[] = {
-                                       { "driver", 1, 0, 'd'
-                                       },
+                                       { "driver", 1, 0, 'd'},
                                        { "verbose", 0, 0, 'v' },
                                        { "help", 0, 0, 'h' },
                                        { "port-max", 1, 0, 'p' },
@@ -450,7 +449,7 @@
     if (!realtime && client_timeout == 0)
         client_timeout = 500; /* 0.5 sec; usable when non realtime. */
 
-    int res = JackStart(driver_desc, driver_params, sync, client_timeout, realtime, realtime_priority, loopback, xverbose, server_name);
+    int res = JackStart(driver_desc, driver_params, sync, client_timeout, realtime, realtime_priority, loopback, port_max, xverbose, server_name);
     if (res < 0) {
         printf("Cannot start server... exit\n");
         JackDelete();
