Skip to content

Commit

Permalink
Add MemoryCheck service for monitoring max heap memory
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcolon021 committed Nov 1, 2024
1 parent 1dd78ac commit 92be964
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ ENV DATASOURCE_USERNAME=${DATASOURCE_USERNAME}
ENV SPRING_PROFILE=${SPRING_PROFILE}

# Default to no profile
ENTRYPOINT java $DEBUG_VARS $PROXY_VARS -Xmx8192m -jar /dictionary.jar --spring.profiles.active=${SPRING_PROFILE:-}
ENTRYPOINT java $DEBUG_VARS $PROXY_VARS -Xmx8192m ${JAVA_OPTS} -jar /dictionary.jar --spring.profiles.active=${SPRING_PROFILE:-}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package edu.harvard.dbmi.avillach.dictionary.memory;

import jakarta.annotation.PostConstruct;
import org.springframework.stereotype.Service;

@Service
public class MemoryCheck {

@PostConstruct
public void checkMemory() {
long maxMemory = Runtime.getRuntime().maxMemory() / (1024 * 1024);
System.out.println("Max Heap Memory (Xmx): " + maxMemory + " MB");
}

}

0 comments on commit 92be964

Please sign in to comment.