Skip to content

Instantly share code, notes, and snippets.

@up1
Last active June 3, 2024 07:39
Show Gist options
  • Save up1/0e519e39ed0766084cb4e194c9ab6ff7 to your computer and use it in GitHub Desktop.
Save up1/0e519e39ed0766084cb4e194c9ab6ff7 to your computer and use it in GitHub Desktop.
CDS :: Spring Boot 3.3.0
$./mvnw clean package
$java -jar target demo.jar
Started Demo33Application in 1.49 seconds (process running for 2.434)
Memory footprint at startup: 40-70 MB
$java -Djarmode=tools -jar target/demo.jar extract
$cd demo
$java -jar demo.jar
Started Demo33Application in 0.637 seconds (process running for 0.78)
Memory footprint at startup: 30-40 MB
@Component
public class MemoryUsageLogger implements ApplicationRunner {
private static final Logger logger = LoggerFactory.getLogger(MemoryUsageLogger.class);
@Override
public void run(ApplicationArguments args) {
Runtime runtime = Runtime.getRuntime();
long memoryUsedBytes = runtime.totalMemory() - runtime.freeMemory();
long memoryUsedMB = memoryUsedBytes / (1024 * 1024);
logger.info("Memory footprint at startup: {} MB", memoryUsedMB);
}
}
<build>
<finalName>demo</finalName>
<plugins>
...
<plugin>
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
{
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"serialNumber": "urn:uuid:7ab5ca8a-2763-34dc-9466-656739c7c373",
"version": 1,
"metadata": {
"timestamp": "2024-06-03T07:34:31Z",
"lifecycles": [
{
"phase": "build"
}
],
"tools": [
{
"vendor": "OWASP Foundation",
"name": "CycloneDX Maven plugin",
"version": "2.8.0",
"hashes": [
{
"alg": "MD5",
"content": "76ffec6a7ddd46b2b24517411874eb99"
},
{
"alg": "SHA-1",
"content": "5b0d5b41975b53be4799b9621b4af0cfc41d44b6"
},
{
"alg": "SHA-256",
"content": "6852aa0f4e42a2db745bab80e384951a6a65b9215d041081d675780999027e81"
},
{
"alg": "SHA-512",
"content": "417de20fcdcb11c9713bacbd57290d8e68037fdb4553fd31b8cb08bd760ad52dc65ea88ad4be15844ad3fd5a4d3e440d2f70326f2fe1e63ec78e059c9a883f8d"
},
{
"alg": "SHA-384",
"content": "5eb755c6492e7a7385fa9a1e1f4517875bcb834b2df437808a37a2d6f5285df428741762305980315a63fcef1406597d"
},
{
"alg": "SHA3-384",
"content": "0fe16a47cf7aab0b22251dafcc39939b68e8f1778093309d8d2060b51a08df445a8b8ed5a9561669faf2e55f907c76d8"
},
{
"alg": "SHA3-256",
"content": "3e5a1eb5ab7d0797498862794709ff8eaaa071fe4cc9ec77f52db7e2f97ef487"
},
{
"alg": "SHA3-512",
"content": "59281a3e29e76270d7f44b40b5b9f05e55f1ae3ec716d80add806f360940809e3813998ac7c5758043b8e248aed73b86e37dc506cdb4cde03c16bb617d8e5a3a"
}
]
}
],
"component": {
"group": "com.example",
"name": "demo33",
"version": "0.0.1-SNAPSHOT",
"description": "Demo project for Spring Boot",
"licenses": [
{
"license": {
"id": "Apache-2.0"
}
}
],
"purl": "pkg:maven/com.example/demo33@0.0.1-SNAPSHOT?type=jar",
"externalReferences": [
{
"type": "website",
"url": "https://spring.io/projects/spring-boot/demo33"
},
{
"type": "vcs",
"url": "https://github.com/spring-projects/spring-boot/demo33"
}
],
"type": "application",
"bom-ref": "pkg:maven/com.example/demo33@0.0.1-SNAPSHOT?type=jar"
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment