File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,8 +64,16 @@ async function showOOMMessage(): Promise<void> {
6464 }
6565}
6666
67+ function getMaxMemFromConfiguration ( includeUnit ?: boolean ) : string | undefined {
68+ const jvmArgs : string = getJavaConfiguration ( ) . get ( 'jdt.ls.vmargs' ) ;
69+ const results = includeUnit ? MAX_HEAP_SIZE_EXTRACTOR_WITH_UNIT . exec ( jvmArgs )
70+ : MAX_HEAP_SIZE_EXTRACTOR . exec ( jvmArgs ) ;
71+ return results && results [ 0 ] ? results [ 1 ] : undefined ;
72+ }
73+
6774const HEAP_DUMP_FOLDER_EXTRACTOR = new RegExp ( `${ HEAP_DUMP_LOCATION } (?:'([^']+)'|"([^"]+)"|([^\\s]+))` ) ;
6875const MAX_HEAP_SIZE_EXTRACTOR = new RegExp ( `-Xmx([0-9]+)[kKmMgG]` ) ;
76+ const MAX_HEAP_SIZE_EXTRACTOR_WITH_UNIT = new RegExp ( `-Xmx([0-9]+[kKmMgG])` ) ;
6977
7078/**
7179 * Returns the heap dump folder defined in the user's preferences, or undefined if the user does not set the heap dump folder
@@ -980,6 +988,12 @@ function registerOutOfMemoryDetection(storagePath: string) {
980988 if ( heapDumpFolder === storagePath ) {
981989 fse . remove ( path ) ;
982990 }
991+ apiManager . fireTraceEvent ( {
992+ name : "java.process.outofmemory" ,
993+ properties : {
994+ maxMem : getMaxMemFromConfiguration ( true ) ,
995+ }
996+ } ) ;
983997 showOOMMessage ( ) ;
984998 serverStatusBarProvider . setError ( ) ;
985999 activationProgressNotification . hide ( ) ;
You can’t perform that action at this time.
0 commit comments