diff --git a/inference-engine/thirdparty/movidius/mvnc/src/mvnc_api.c b/inference-engine/thirdparty/movidius/mvnc/src/mvnc_api.c index b67a7fcb1f818b..b7a9f86fc0564c 100644 --- a/inference-engine/thirdparty/movidius/mvnc/src/mvnc_api.c +++ b/inference-engine/thirdparty/movidius/mvnc/src/mvnc_api.c @@ -1986,11 +1986,6 @@ ncStatus_t ncGraphAllocate(struct ncDeviceHandle_t * deviceHandle, struct _graphPrivate_t *g = graphHandle->private_data; struct _devicePrivate_t *d = devices; - if (graphBufferLength > d->dev_attr.max_memory) { - mvLog(MVLOG_ERROR, "The graph file is bigger than the device memory"); - return NC_OUT_OF_MEMORY; - } - GLOBAL_LOCK(); while (d) { if (d == deviceHandle->private_data) @@ -2006,6 +2001,11 @@ ncStatus_t ncGraphAllocate(struct ncDeviceHandle_t * deviceHandle, } GLOBAL_UNLOCK(); + if (graphBufferLength > d->dev_attr.max_memory) { + mvLog(MVLOG_ERROR, "The graph file is bigger than the device memory"); + return NC_OUT_OF_MEMORY; + } + lockAllInferences(); g->id = graphIdCount++; streamId_t streamId;