Questions tagged [heap-fragmentation]

32 questions
0
votes
1 answer

A sample test java code which can demonstrate memory fragmentation in heap

I would like to understand on how a memory fragmentation can occur by writing some bad code in the java user space. Please point out me with some ideas which can help me to understand this. In my understanding I was thinking like, java heap…
Navaneeth Sen
  • 6,315
  • 11
  • 53
  • 82
-1
votes
1 answer

Reallocate memory to avoid memory fragmentation

Here is a simple example to explain the issue (with c++) : A* a1 = new A; A* a2 = new A; A* a3 = new A; delete(a2); B* b = new B; . . . let's say the size of an A object is 3, and the size of a B object is 4, and the size of my heap is 12, after…
1 2
3