Skip to content

Huge memory usage when saving non-readonly project #106

@xalexalex

Description

@xalexalex

Hello,

when iterating over the images of a large project (>200 mirax WSIs), memory is allocated but never freed until I get a java.lang.OutOfMemoryError: java.lang.OutOfMemoryError: Java heap space. Full stack trace is here.

I have tried the following JVM options (one at a time) but eventually I still get the OOM error:

  • "-XX:MaxRAMPercentage=50",
  • "-XX:MaxRAMPercentage=90",
  • "-Xmx8g",

Culprit code used to generate the stack trace follows:

with QuPathProject('/path/to/proj', mode='r+') as qp:
    for image in qp.images:
        print(image.name)
        if image.name not in some_list:
            continue
        print('would go on')
        continue

However the error is reproducible even with something as simple as:

with QuPathProject('/path/to/proj', mode='r+') as qp:
    for image in qp.images:
        pass

note that after a recent commit (I think this one, but I haven't bisected), one can iterate over qp.images just fine if the project is in 'r' mode.

However this doesn't fix my problem because I have to iterate over this project in 'r+' mode to edit the detections of all images.

Any help or guidance?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions