1 /* Copyright (c) 2016-2020. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 /* This test ensures that the used semaphores are not garbage-collected while we still use it.
7 * This was reported as bug #19893 on gforge.
12 import org.simgrid.msg.*;
13 import org.simgrid.msg.Process;
15 class SemCreator extends Process {
16 SemCreator(Host h, String n){
20 public void main(String[] args) throws MsgException{
22 Msg.info("Creating 50 new Semaphores, yielding and triggering a GC after each");
23 for(j = 1; j <= 50; j++) {
28 Msg.info("It worked, we survived. The test is passed.");
32 public class SemaphoreGC {
33 private SemaphoreGC() {
34 throw new IllegalAccessError("Utility class");
37 public static void main(String[] args) throws Exception {
39 if (args.length < 1) {
40 Msg.info("Usage: java -cp simgrid.jar:. semaphoregc.SemaphoreGC <deployment.xml>");
43 Msg.createEnvironment(args[0]);
45 new SemCreator(Host.getByName("Fafard"), "SemCreator").start();