Libraryless. Click here for Pure Java version (8113L/46K).
// Idea: Every class loader makes only a single class so they can be // garbage collected more easily. srecord noeq LASMultiClassLoader(ClassLoader parent) is ILASClassLoader { settable bool rememberClassBytes; gettable Map<S, Class> definedClasses = syncMap(); Lock lock = lock(); *(Class parent) { this(parent.getClassLoader()); } public Class<?> defineLASClass(S name, IF0<byte[]> generateClass) { lock lock; try object definedClasses.get(name); var cl = new InMemoryClassLoader(parent); print("Generating class " + name); Class c = cl.defineAClass(name, generateClass!); definedClasses.put(name, c); ret c; } }
Began life as a copy of #1035329
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035348 |
Snippet name: | LASMultiClassLoader backup before weak references |
Eternal ID of this version: | #1035348/1 |
Text MD5: | 4a3f62ceea18d22cafbb311500b2fe8b |
Transpilation MD5: | 552cf38743db58a616dd5c2ffc5db969 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-05-01 19:34:52 |
Source code size: | 701 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 112 / 154 |
Referenced in: | -