RCProject::deletePointsFromStructuredScan() memory use

RCProject::deletePointsFromStructuredScan() memory use

ben.sVNSSU
Participant Participant
1,159 Views
2 Replies
Message 1 of 3

RCProject::deletePointsFromStructuredScan() memory use

ben.sVNSSU
Participant
Participant

I'm trying to delete points from structured scans from a large ReCap project and the RCProject::deletePointsFromStructuredScan() function consistently runs out of memory and fails with a bad allocation exception.

 

The code looks like this:

/// Delete the points from the panorama clouds to reduce the size of the project on disk
void DeletePanoramaPoints(const std::string& rcp_path) {
  Foundation::RCCode error_code;
  auto project = Data::RCProject::loadFromFile(rcp_path, Data::RCFileAccess::ReadWrite,
                                               Data::RCProjectUserEdits::None, error_code);
  recap_utils::CheckCode(error_code, "project load");

  // Permanently remove deleted scan points to reduce project size on disk    
  recap_utils::CheckCode(project->deletePointsFromStructuredScan(true), "deleting points from structured scans");
  if (!project->permanentlyDeletePoints()) {
    throw std::runtime_error("Could not permanently delete points");
  }
}

The ReCap project has one unstructured scan and many structured scans, and all of the points in the structured scans are marked as deleted (using approach from https://forums.autodesk.com/t5/recap-sdk/deleting-points/m-p/10414930/highlight/true#M353). The code above works well for models with a small number of scans, but fails for a model with 279 scans. All structured scans have the same number of points and the total size on disk is ~207G. Total system memory is 32G.

 

Currently the call to deletePointsFromStructuredScan() uses all the available system memory and then fails with a bad allocation exception. Alternatively, if the call to deletePointsFromStructuredScan() is removed then it succeeds but the project size on disk remains the same.

 

  • Is this a bug? Other functions seem to respect the system memory limit set in the ReCap SDK (
    RCProject::setSystemMemoryLimitInMB()) e.g. when setting the points as deleted in the large model, memory use grows to ~50% and then the memory for cached scans is freed so that the threshold is not exceeded. Should deletePointsFromStructuredScan() also respect the SDK's memory limit?
  • What is the recommended way to delete points from a project that is too big to fit entirely into memory?
  • Is there a workaround to delete points scan-by-scan rather than per-project? I don't see any method in RCScan or RCStructuredScan to permanently delete points, it seems to be only accessible via RCProject which then iterates over each scan in the project itself.

Thanks in advance for any help.

Accepted solutions (1)
1,160 Views
2 Replies
Replies (2)
Message 2 of 3

yan.fu
Alumni
Alumni
Accepted solution

Hi @ben.sVNSSU ,

 

Thank you for reporting this issue.

For large project, it looks like some cached data are not cleared timely so it will cause the out of memory issue. 

We will fix this issue.

 

Thanks,

Yan

Message 3 of 3

ben.sVNSSU
Participant
Participant

Thanks for confirming.

 

In case it's useful for others I found a workaround. Pseudocode:

scan_names  # list of scan names to delete points from
for scan_name in scan_names:
  create Data::RCProjectImporter
  create list of scan files based on scan_name
  call Data::RCProjectImporter::importFilesSynchronously()
  # Now we have a project that contains a single scan and references the .rcp and .rcc files in the original project support folder
  load the new project
  call Data::RCProject::deletePointsFromStructuredScan()
  call call Data::RCProject::permanentlyDeletePoints()

 I found when I used createChildProject() and waitTillFinished() that it consistently hung on some machines, but using importFilesSynchronously() seems to work ok.