After intensive research, I found the solution so you can scan without getting memory...
OutOfMemoryException in call to WindowsTwaindsmDsmEntryUserinterface external method.