12,274 questions
2
votes
1
answer
80
views
Freeing memory to OS after heavy function without forcing GC
I have a Python function that consumes a large amount of memory. When the function finishes, I want to release the memory and return the freed pages to the operating system by calling malloc_trim(0).
...
24
votes
2
answers
2k
views
Why do JavaScript Websocket objects not get destroyed when they go out of scope?
In JavaScript, when you do something like this,
function connect() {
var ws = new WebSocket(url);
ws.onmessage = function(e) {
window.alert(e.data);
};
}
it will work. But why ...
0
votes
2
answers
170
views
What is the difference between the Heap size and the Private Bytes size?
I have a .Net 4.7 application (WPF) whose memory consumption increases to 5.785 GB in private bytes, but the heap bytes are 4.260 GB, as shown in the figure taken by Process-Explorer:
If I run GC ...
0
votes
1
answer
152
views
Why do Images leave giant piles of RAM behind them? [closed]
I am currently working on a .NET 9 WinForms program that contains an ImageViewer, which is a seperate window where you can scroll through a series of images.
My problem is that even after closing the ...
2
votes
1
answer
171
views
Does JavaScript object destructuring allocate a new object?
In the following JavaScript, does the object destructuring that follows the creation of target create a new (temporary) object that has to be garbage collected? In other words, are there two objects ...
1
vote
1
answer
81
views
Under what circumstances can a write to a Haskell unsafeThaw-ed array/vector result in a segfault (via lost GC root)?
This question tries to collect the full picture if/when a stale object reference can happen from an old-gen (immutable) array referring a newer-gen object, from fragments of information.
Preface: was ...
0
votes
0
answers
47
views
H2O-3 Calling a lot of GC calls in java when trying to load CSV file with 16M rows
I am using h2o-3 java repo to load this frame but have been running into memory issues with constant GC pressure.
The actual frame size is 3.31 GB as per h2o logs, but the peak JVM usage comes to be ...
2
votes
1
answer
89
views
How can I tie a coroutine's lifetime to the lifetime of an object?
I have some code similar to this:
class Foo {
var x = 0
init {
GlobalScope.launch {
while (true) {
delay(1000)
x += 1
}...
2
votes
1
answer
176
views
Native objects do not trigger garbage collection
I am trying to do some linear algebra in Kotlin/JVM and I have two ways of doing it:
Using Apache commons-math, which implements matrix multiplication purely on the JVM
Using OpenCV's Mat class and ...
0
votes
2
answers
108
views
Is there a better way to simulate work in unit tests? [closed]
My company is finally starting to introduce unit tests.
While going through some of the new tests, I came across this one:
[Test]
public void GetCorrectTimeoutInfoFromTimeSpan()
{
// Arrange
...
2
votes
2
answers
576
views
How to release memory of intermediate Python-Polars DataFrames in a large dependency graph?
I am performing operations on a directed acyclic graph (DAG) of DataFrames using Polars (eager API).
Here’s a simplified example of my workflow:
Read parquet files into df1.
Use df1 to create df2 and ...
1
vote
1
answer
59
views
Looking for simple garbage collector load test
I'm looking for some code or some benchmark to roughly asses the pause times or cpu load caused by some GC in order to get some rough estimate how efficient it is. I just want to see whether some GC ...
1
vote
0
answers
96
views
System.Windows.Forms's WebBrowser is garbage collected differently in .NET Framework and Core
I'm trying to migrate our application from .NET Framework to .NET Core. In one of our tests, an object of type ZWebBrowser : System.Windows.Forms.WebBrowser is not garbage collected correctly, due to ...
1
vote
2
answers
95
views
How can I manually trigger garbage collection from an asynchronous javascript function?
I'm calling global.gc() in some unit tests, but for some reason it only seems to have any impact when called synchronously. If I call it asynchronously, I never seem to get a cleanup callback in my ...
0
votes
1
answer
150
views
Java 17: Metaspace (data) allocation failure in GC log without a java.lang.OutOfMemoryError: Metaspace
I am seeing the below in the GC log before the JVM pauses for several minutes after which it gets restarted externally.
[2025-07-18T18:08:42.605-0600][info][gc,metaspace,freelist,oom] Metaspace (data) ...