Can ANYONE spot the memory leak??
Hi, I have some code here, and there is a SERIOUS memory leak. Basically, I realized the leak was there when a report tried to execute this 100,000+ times and it bogged the system down to a crawl. Can anyone spot the leak? I will explain the variables below the code:
char* getDescription(char* chFlag, char* chDEID, char* chKey, int keysize)
//first, we need to allocate new Byte arrays....
jbyteArray JchFlag = (*env1)->NewByteArray(env1,1);
jbyteArray JchDEID = (*env1)->NewByteArray(env1,2);
jbyteArray JchKey = (*env1)->NewByteArray(env1,40);
//next, we need to put the correct info in those byte arrays....
(*env1)->SetByteArrayRegion(env1,JchFlag,0,1,(jbyte*)chFlag); (*env1)->SetByteArrayRegion(env1,JchDEID,0,2,(jbyte*)chDEID); (*env1)->SetByteArrayRegion(env1,JchKey,0,40,(jbyte*)chKey);
getDescriptionID =(*env1)->GetMethodID(env1,myjclass,"getDescription","([B[B[BI)Ljava/lang/String;");
result =(jstring)((*env1)->CallObjectMethod(env1,myjobject,getDescriptionID,JchFlag,JchDEID,JchKey,keysize)) ;
returnvalue = NULL;
if(result == NULL)
strcpy(holder1, "**********Error Finding Description**********");
else { //now, we convert the jstring to a char *, so we can return the proper type...
returnvalue=(char*)((*env1)->GetStringUTFChars(env1,result,&isCopy)) ;
strcpy(holder1,returnvalue);
if(isCopy == JNI_TRUE)
(*env1)->ReleaseStringUTFChars(env1,result,returnvalue);
(*env1)->DeleteLocalRef(env1,result);
return holder1;
//return description;
}//end getDescription function
-myjclass is global, it gets its value in the initialization.
-any variables that are not declared in this function are, of course, globally defined.
Hello Friends,
I had also tried to use the ReleaseStringUTFChars after making the check of whether it does a copy or not.
For me in Windows, it works fine most of the time. But when I go on increasing the no. of strings in a Vector of objects to more than 500 or something , then it occasionally fails.
Just before ReleaseStringUTF, I do have the copied string in char* .
Soon after Releasing, I do get a junk in the character array.
I dont know why it happens like this.
Please advice.
Everyone suggest ReleaseStringUTF.
But why it fails in Windows.
And any one know about how it will behave in Alpha.
It totally fails in Alpha.
I could not get the string at all.
Please help
LathaDhamo
Similar Messages
-
Can't find the memory leak in Managed Object
Hey guys...I am trying to find the memory leak that Instruments says I have in this section of code setting up a managed object:
oCurrentSection = (Section*) [NSEntityDescription insertNewObjectForEntityForName:@"Section" inManagedObjectContext:[[CoreDataManager sharedData] oManagedObjectContext]];
oCurrentSection.nsSectionName = [attributeDict objectForKey:@"name"];
oCurrentSection.nsImgUrl = [attributeDict objectForKey:@"imgURL"];
oCurrentSection.nsDesc = [attributeDict objectForKey:@"desc"];
oCurrentSection.iOrder = [NSNumber numberWithInt: [[attributeDict objectForKey:@"order"] intValue]];
Can anyone help me out?Thanks everyone! That makes a lot more sense. Yes, kjon, I do come from windows. But please don't reference my troubled past. Actually, I typically use "ps aux | sort -n +3 | tail -1" rather than simply "ps aux" - I just wanted to make sure I wasn't missing something by looking at only the top memory-user. Glad to know there's no massive memory leak in my system
Procyon, what's wrong with a huge swap? Wouldn't you do it too if you were given a system with 200GB hdd more than necessary and told to make a webserver?
[root@norpass ~]# df -H
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 7.9G 1.1G 6.8G 14% /
none 1.1G 0 1.1G 0% /dev/shm
/dev/sda1 40M 9.9M 28M 27% /boot
/dev/sda4 238G 4.5G 234G 2% /home -
Can anyone spot the problem with this coding??
can anyone spot this problem with my program. it keeps saying
"missing return statement } " with a little arrow beneath the bracket.
many thanks
public class Game extends GameInterface
GameInterface gameInt = new GameInterface();
String boardString;
// final static char NOUGHT='O', CROSS='X';
private int square = 0;
Player player1 = new Player();
Player player2 = new Player();
String firstPlayer, secondPlayer;
public Game() // Constructor
boardString = "0123456789";
public boolean initialise(boolean first)
gameInt.setPlayerNames(player1,player2);
MyPrint.myPrintln("Player one name is " + player1.getName());
MyPrint.myPrintln("Player two name is " + player2.getName());
String P1 = player1.getName();
String P2 = player2.getName();
}It means you declare your method to return something, but you don't actually return anything.
-
FileExtract - Can anyone spot the deliberate mistake please?
Basically, the program includes my add-in along with SAPbouiCOM.dll both embedded.
The code below now extracts SAPbouiCOM.dll perfectly, but my program is condensed to 1Kb!!!
I bet there's something obvious here, but I just can't spot it!
Private Sub ExtractFile(ByVal path As String)
Try
Dim AddonExeFile As IO.FileStream
Dim thisExe As System.Reflection.Assembly
thisExe = System.Reflection.Assembly.GetExecutingAssembly()
Dim sTargetPath As String
Dim sSourcePath As String
Dim sTargetPathdll As String
Dim sFile As System.IO.Stream
sTargetPath = path & "\" & sAddonName & ".exe"
sSourcePath = path & "\" & sAddonName & ".tmp"
sTargetPathdll = path & "\" & "Interop.SAPbouiCOM.dll"
For Each resourceName As String In thisExe.GetManifestResourceNames()
sFile = thisExe.GetManifestResourceStream(resourceName)
If LCase(resourceName) <> LCase("Addoninstaller.Interop.SAPbouiCOM.dll") Then
' Create a tmp file first, after file is extracted change to exe
If IO.File.Exists(sSourcePath) Then
IO.File.Delete(sSourcePath)
End If
AddonExeFile = IO.File.Create(sSourcePath)
Dim buffer() As Byte
ReDim buffer(sFile.Length)
sFile.Read(buffer, 0, sFile.Length)
AddonExeFile.Write(buffer, 0, sFile.Length)
AddonExeFile.Close()
If IO.File.Exists(sTargetPath) Then
IO.File.Delete(sTargetPath)
End If
' Change file extension to exe
IO.File.Move(sSourcePath, sTargetPath)
Else
' Create a tmp file first, after file is extracted change to exe
AddonExeFile = IO.File.Create(sTargetPathdll)
Dim buffer2() As Byte
ReDim buffer2(sFile.Length)
sFile.Read(buffer2, 0, sFile.Length)
AddonExeFile.Write(buffer2, 0, sFile.Length)
AddonExeFile.Close()
End If
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
End SubHi Daniel,
I'm a bit lazy - so I'm not going to go through your code -> I'll give you a code snippet I use (it is basically the same as in the SAP example)
"in someSub"
' Extract exe to installation folder
ExtractFile(strDest, "YourAddonName", "exe")
' Extract dlls to installation folder
ExtractFile(strDest, "Interop.SAPbobsCOM", "dll")
"end someSub"
' This function extracts the given add-on into the path specified
Private Sub ExtractFile(ByVal path As String, ByVal FName As String, ByVal ext As String)
Dim AddonExTFile As IO.FileStream
Dim thisExT As System.Reflection.Assembly
Dim file As System.IO.Stream
Dim sTargetPath = path & "\" & FName & "." & ext
Dim sSourcePath = path & "\" & FName & ".tmp"
Try
Try
thisExT = System.Reflection.Assembly.GetExecutingAssembly()
file = thisExT.GetManifestResourceStream(sInstallName & "." & FName & "." & ext)
' Create a tmp file first, after file is extracted change to ext
If IO.File.Exists(sSourcePath) Then
IO.File.Delete(sSourcePath)
End If
AddonExTFile = IO.File.Create(sSourcePath)
Dim buffer() As Byte
ReDim buffer(file.Length)
file.Read(buffer, 0, file.Length)
AddonExTFile.Write(buffer, 0, file.Length)
AddonExTFile.Close()
If IO.File.Exists(sTargetPath) Then
IO.File.Delete(sTargetPath)
End If
' Change file extension to exe
IO.File.Move(sSourcePath, sTargetPath)
Catch ex As Exception
MsgBox(ex.Message)
End Try
Finally
AddonExTFile = Nothing
thisExT = Nothing
file = Nothing
sTargetPath = ""
sSourcePath = ""
GC.Collect()
End Try
End Sub
AND remenber to include your exe and dll as embedded resources in your Add-On installer -
Can anyone spot the syntax error of db delete?
Hi
I'm trying to get a database delete statement to work for a relations table - it just has studentId and courseId as foreign keys which make up a joint primary key.
The line is
db.update("delete from enrollments2 where (studentsid = '" + getStudentId() + "," + " coursesid = " + getCourseId() + "')");The error is
ERROR: invalid input syntax for integer: "78, coursesid = 75"Somehow I am putting non integer into an integer... I can't seem to spot the mistake though. Any help would be appreciated.The correct syntax I should mention was
db.update("delete from enrollments2 where (studentsid = '" + getStudentId() + "'and coursesid = '" + getCourseId() + "')");I'll leave that in for the time being and try to come back to it tonight... its on my todo list.
Thanks for the snippet by the way, it always saves a lot of time when someone provides a useful snippet towards a solution. I hadn't heard of prepared statements until now too, interesting.
Message was edited by:
occams_razor
-->> missed a 2 out there as enrollments2 is my test case -
Can anyone spot the problem?
Hey i've been workin on an applet which accepts two boolean equations with 3 variables and returns an answer telling if they are logically equal. When it comes to the PLUS and MINUS cases the program works fine. However in the TIMES and DIVIDE cases it returns at least one wrong answer, despite the fact i'm using the logical AND gate. For example if i enter x*y the program returns
answer 1 = O, when (x,y)=(0,0)
answer 2 = 1, when (x,y)=(1,0)
answer 3 = O, when (x,y)=(0,1)
answer 4 = 1, when (x,y)=(1,1)
were answer 2 is wrong using an AND gate.
Here is the for loop which passes the values
for (int y = 0; y < 2; y++)
for (int x = 0; x < 2; x++)
int d = MyParser.answer(x, y);
int doub = MyParser2.answer(x, y);
String eq = "";
if (d == doub) {
equal++;
count++;
eq = "equal\t";
else {
count++;
eq = "not equal";
tb1.append("\nAnswer was " + d + "\t " + eq + " " +
"\t answer 2 was " + doub);
}and here is the code for the parser
package Applet1;
public final class Parse
public Parse (String equation)
parse (equation);
public int answer(int x,int y, int z)
return this.value(x,y,z);
public int answer(int x,int y)
return this.value(x, y);
public int answer(int x)
return this.value(x);
public int value(int x)
return val(x, 0, 0);
public int value(int x, int y)
return val(x, y, 0);
public int value(int x, int y, int z)
return val(x, y, z);
public String getEquation()
return equation;
private String equation;
private byte[] code;
private int[] stack;
private int[] constant;
private int pos = 0, constantCt = 0, codeSize = 0;
private static final byte
PLUS = -1, MINUS = -2, TIMES = -3, DIVIDE = -4,
UNARYMINUS = -5, VARIABLEX = -6, VARIABLEY = -7, VARIABLEZ = -8;
private char next()
if (pos >= equation.length())
return 0;
else
return equation.charAt(pos);
private void skip()
while (Character.isWhitespace(next()))
pos++;
private int val(int variableX, int variableY, int variableZ)
try
int top = 0;
for (int i=0; i < codeSize; i++)
if (code[i] >= 0)
stack [top++] = constant [code ];
else if (code [i] >= UNARYMINUS)
int y = stack[--top];
int x = stack[--top];
int w;
int ans = (int) Double.NaN;
switch (code[i])
case PLUS: ans = x | y;
break;
case MINUS: ans = (x) & (~y);
break;
case TIMES: ans = x & y;
break;
case DIVIDE: ans = x & ~y;
break;
if (Double.isNaN(ans))
return ans;
stack [top++] = ans;
else if (code[i] == VARIABLEX)
stack [top++] = variableX;
else if (code[i] == VARIABLEY)
stack [top++] = variableY;
else if (code[i] == VARIABLEZ)
stack [top++] = variableZ;
catch (Exception e)
double b = Double.NaN;
int i = (int) b;
return i;
double d2;
if (Double.isInfinite(stack[0]))
d2 = Double.NaN;
int i2 = (int) d2;
return i2;
}else
return stack[0];
private void error (String message)
throw new IllegalArgumentException
("Parse error: " + message + "\n");
private int stackUse()
int s = 0;
int max = 0;
for (int i = 0; i < codeSize; i++)
if (code[i] >= 0 || code [i] == VARIABLEX || code[i] == VARIABLEY || code[i] == VARIABLEZ)
s++;
if (s > max)
max = s;
} else if (code[i] >= UNARYMINUS)
s--;
return max;
private void parse (String equation)
if (equation == null || equation.trim().equals(""))
error ("No Data to be parsed");
this.equation = equation;
code = new byte[equation.length()];
constant = new int [equation.length()];
parseExpress();
skip();
int stackSize = stackUse();
stack = new int[stackSize];
byte[] c = new byte[codeSize];
System.arraycopy(code,0,c,0,codeSize);
code = c;
int[] A = new int[constantCt];
System.arraycopy(constant,0,A,0,constantCt);
constant = A;
private void parseExpress()
boolean neg = false;
skip();
parseVaries();
if (neg)
code[codeSize++] = UNARYMINUS;
skip();
while (next() == '+' || next() == '-')
char op = next();
pos++;
parseTerm();
if (op =='+')
code[codeSize++] = PLUS;
else
code[codeSize++] = MINUS;
skip();
private void parseTerm()
parseFactor();
skip();
while (next() == '*' || next() == '/')
char op = next();
pos++;
parseFactor();
code[codeSize++] = (op == '*')? PLUS:MINUS;
skip();
private void parseFactor()
parseVaries();
skip();
while (next() == '^')
pos++;
parseVaries();
code[codeSize++] = UNARYMINUS;
skip();
private void parseVaries()
skip();
char ch = next();
if (ch == 'x' || ch =='X')
pos++;
code[codeSize++] = VARIABLEX;
else if (ch == 'y' || ch == 'Y')
pos++;
code[codeSize++] = VARIABLEY;
else if (ch == 'z' || ch == 'Z')
pos++;
code[codeSize++] = VARIABLEZ;
else if (ch == '(')
pos++;
parseExpress();
skip();
if (next () !=')')
error("Right parenthesis needed");
pos++;
else if (ch == ')')
error ("Need a left parenthesis");
else if (ch == '+' || ch == '-' || ch == '*' || ch =='/' || ch =='^')
error ("Operator" + ch + "\n found in unexpected position");
else if (ch == 0)
error ("Incorrect entry");
else
error ("Illegal character " + ch);
Its not pretty i know and its missing a part to parse Digits and i'm using type casting for strange reasons, but it does work. Except for in these two cases, can anyone see why
Thanks
podgerI'm not even entirely certain what you are trying to accomplish here.
It looks wrong in any case.
I can't see anything in the way of debugging, so heres my help for today:
public void printCode(){
System.out.println(equation + ":");
for(int i=0; i<code.length; i++){
switch(code){
case PLUS: System.out.print("Plus "); break;
case MINUS: System.out.print("Minus "); break;
case TIMES: System.out.print("TIMES "); break;
case DIVIDE: System.out.print("DIVIDE "); break;
case UNARYMINUS: System.out.print("-"); break;
case VARIABLEX: System.out.print("x "); break;
case VARIABLEY: System.out.print("y ");break;
case VARIABLEZ:System.out.print("z ");break;
System.out.println();
I suggest you parse a couple of expressions, and print out the code generated using this handy little method.
Parse parse = new Parse("x+y");
parse.printCode();
parse = new Parse("x*y");
parse.printCode();(x+y) : x y Plus
(x*y) : x
I think you will find the problem in your parseExpress method (well one of your problems anyway)
Also take a look at your ParseTerm function - I'm pretty sure that a * is meant to represent "TIMES" and not "PLUS"
Did you ever thing about using switch statements rather than ifs?
Good luck,
evnafets -
Can anyone spot the syntax error?
I've been looking at this for about a day now and can't see the error, which is:
Insert Failed: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
public String addSaleList(SaleList sL) {
try {
//Gets the connection to customer database.
Class.forName(Driver);
Connection myCon = DriverManager.getConnection(Url);
System.out.println(sL.saleListID + " " + sL.saleID + " " + sL.product
+ " " + sL.number);
String sqlQry = "INSERT INTO salelist(saleID, product, number)" +
"VALUES(?,?,?)";
PreparedStatement myStmt = myCon.prepareStatement(sqlQry);
myStmt.setInt(1, sL.saleID);
myStmt.setString(2, sL.product);
myStmt.setInt(3, sL.number);
myStmt.executeUpdate();
return "Sale confirmed";
catch (Exception e) {
System.out.println("Insert Failed: " + e);
return ("Insert Failed: " + e);
public class SaleList {
public int saleListID;
public int saleID;
public String product;
public int number;
public SaleList(int saleListID, int saleID, String product, int number) {
this.saleListID = saleListID;
this.saleID = saleID;
this.product = product;
this.number = number;
SaleList saleL = new SaleList(0,10,"b",2);
lblStatus.setText(sM.addSaleList(saleL));Hey this is the stack trace:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execut(JdbcOdbcPreparedStatement.java:214)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdateJdbcOdbcPreparedStatement.java:136)
at myproject.SaleModel.addSaleList0 120 a 1
(SaleModel.java:69)
at myproject.SalesGUI.actionPerformed(SalesGUI.java:395)
at java.awt.Button.processActionEvent(Button.java:382)
at java.awt.Button.processEvent(Button.java:350)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) -
Can anyone spot the error in this script for iTunes?
This AppleScript is designed to copy the Name and Artist of an iTunes track, then populate the Album Artist field with both, separated with an oblique. But when I run the script in iTunes, it only pastes the Artist name in to the Album Artist field and not the whole string.
tell application "iTunes"
if selection is not {} then -- if tracks are selected...
set sel to selection
set numTracks to (length of sel)
set s to "s"
if numTracks is 1 then set s to ""
display dialog "Adds the name of the track and the name of the artist to the Album Artist field." & return & return & (numTracks & " track" & s & " selected.") buttons {"Cancel", "Continue"} default button 2 with title "Create Album Artist" giving up after 30
if gave up of result is true then return
repeat with t from 1 to numTracks
tell contents of item t of sel
set {album artist} to ({get artist} & " / " & {get name})
end tell
end repeat
else
display dialog "No tracks have been selected." buttons {"Cancel"} default button 1 with icon 0 giving up after 30
end if -- no selection
end tellHello
Try -
tell item t of sel
set album artist to (get artist) & " / " & (get name)
end tell
instead of -
tell contents of item t of sel
set {album artist} to ({get artist} & " / " & {get name})
end tell
In your original code, the left and right value of assignment are both list, i.e. -
left value = {album artist}
right value = {get artist, "/", get name}
Consequently 'album artist' is assigned to the 1st item of the list at right, which is the result of 'get artist'.
In order to avoid this, don't use list assingment, which is not necessary at all here.
Also, I think you may just tell item t of sel, not contents of item t of sel.
Hope this may help,
H -
How to quickly and accurately find out the memory leak points?
Hi, all.I have added a option -XX:+HeapDumpOnOutOfMemoryError in the bootstarp script of my application.
The application has been run for one day and the OOM error was thrown again. So I downloaded the hprof file and used MAT to parse it.
But after seeing the leak suspects I still have no idea what's wrong and what's the possible leak point.
Can anyone shard some experience how to find out the memory leak points quickly and accurately?
It would be more nice if you can take a loot at the leak supects.
Thanks,
SuoNayiFurthermore, when I try to dump the thread stack, I can see the following errors/warns:
Thread 12135: (state = BLOCKED)
- java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be imprecise)
Error occurred during stack walking:
sun.jvm.hotspot.utilities.AssertionFailure: Only used on C2 x86
at sun.jvm.hotspot.utilities.Assert.that(Assert.java:15)
at sun.jvm.hotspot.code.CodeBlob.getLinkOffset(CodeBlob.java:193)
at sun.jvm.hotspot.runtime.amd64.AMD64Frame.senderForCompiledFrame(AMD64Frame.java:297)
at sun.jvm.hotspot.runtime.amd64.AMD64Frame.sender(AMD64Frame.java:213)
at sun.jvm.hotspot.runtime.Frame.sender(Frame.java:184)
at sun.jvm.hotspot.runtime.Frame.realSender(Frame.java:189)
at sun.jvm.hotspot.runtime.VFrame.sender(VFrame.java:102)
at sun.jvm.hotspot.runtime.VFrame.javaSender(VFrame.java:129)
at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:50)
at sun.jvm.hotspot.tools.JStack.run(JStack.java:41)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:204)
at sun.jvm.hotspot.tools.JStack.main(JStack.java:58) -
Can Java program cause memory leak?
Can Java program cause memory leak or memory crash? I don't mean any memory overflow related exceptions. I mean something like core dump in UNIX or error reports in Windows XP.
If it can really happen, in what circumstances? I raise such a question because our J2EE based system had really caused memory leak in Windows XP systems, but so far we still fail to troubleshoot the problem.Your code may leak memory. There are many, many, many reasons this could be. All of them represent bugs in your code.
You should get a profiler to identify the problem spots of your code.
You spoke of a memory crash as well. The VM may crash with some bug in the VM, or a bug in native code but that is not relevent to your problem. A memory leak is a problem in your code. -
Problems with Overlay Layout - can anyone spot something wrong/missing?
Hi folks, I'm developing a tool that allows you to draw rectangles around objects on an image. The rectangles are then saved, and you can move between images. For some reason, though my rectangles are not drawing on the panel. I am using the Overlay Layout. Can anyone spot what I'm doing wrong? (The TopPanel canvas appears to be there, as it's taking input from the mouse - the problem is simply that the red rectangles are not drawing on the panel). Please help!!
So you know, there is a JFrame in another class which adds an instance of the ObjectMarker panel to it. It also provides buttons for using the next and previous Image methods.
Any other general advice is appreciated too.
* Object_Marker.java
* Created on 07 April 2008, 15:38
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import javax.imageio.ImageIO;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.OverlayLayout;
import javax.swing.event.MouseInputAdapter;
* @author Eric
public class ObjectMarker extends javax.swing.JPanel {
private static final long serialVersionUID = 6574271353772129556L;
File directory;
String directory_path;
Font big = new Font("SansSerif", Font.BOLD, 18);
List<File> file_list = Collections.synchronizedList(new LinkedList<File>());
String[] filetypes = { "jpeg", "jpg", "gif", "bmp", "tif", "tiff", "png" };
// This Hashmap contains List of Rectangles, allowing me to link images to collections of rectangles through the value 'index'.
public static HashMap<Integer, List<Rectangle>> collection = new HashMap<Integer, List<Rectangle>>();
BufferedImage currentImage;
Thread thread;
Integer index = 0;
OverlayLayout overlay;
private TopPanel top;
private JPanel pictureFrame;
String newline = System.getProperty("line.separator");
* Creates new form Object_Marker
* @throws IOException
public ObjectMarker(File directory) {
System.out.println("Got in...");
this.directory = directory;
File[] temp = directory.listFiles();
directory_path = directory.getPath();
// Add all the image files in the directory to the linked list for easy
// iteration.
for (File file : temp) {
if (isImage(file)) {
file_list.add(file);
initComponents();
try {
currentImage = ImageIO.read(file_list.get(index));
} catch (IOException e) {
System.out.println("There was a problem loading the image.");
// 55 pixels offsets the height of the JMenuBar and the title bar
// which are included in the size of the JFrame.
this.setSize(currentImage.getWidth(), currentImage.getHeight() + 55);
public String getImageList() {
// Allows me to build the string gradually.
StringBuffer list = new StringBuffer();
list.append("Image files found in directory: \n\n");
for (int i = 0; i < file_list.size(); i++) {
list.append((((File) file_list.get(i))).getName() + "\n");
return list.toString();
private void initComponents() {
top = new TopPanel();
pictureFrame = new javax.swing.JPanel();
OverlayLayout ol = new OverlayLayout(this);
this.setLayout(ol);
this.add(top);
this.add(pictureFrame);
* private void initComponents() {
* javax.swing.GroupLayout pictureFrameLayout = new
* javax.swing.GroupLayout(pictureFrame);
* pictureFrame.setLayout(pictureFrameLayout);
* pictureFrameLayout.setHorizontalGroup(
* pictureFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
* .addGap(0, 497, Short.MAX_VALUE) ); pictureFrameLayout.setVerticalGroup(
* pictureFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
* .addGap(0, 394, Short.MAX_VALUE) );
* javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
* this.setLayout(layout); layout.setHorizontalGroup(
* layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
* .addComponent(pictureFrame, javax.swing.GroupLayout.DEFAULT_SIZE,
* javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) );
* layout.setVerticalGroup(
* layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
* .addComponent(pictureFrame, javax.swing.GroupLayout.DEFAULT_SIZE,
* javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); }
* This function returns the extension of a given file, for example "jpg" or
* "gif"
* @param f
* The file to examine
* @return String containing extension
public static String getExtension(File f) {
String ext = null;
String s = f.getName();
int i = s.lastIndexOf('.');
if (i > 0 && i < s.length() - 1) {
ext = s.substring(i + 1).toLowerCase();
} else {
ext = "";
return ext;
public String getDetails() {
saveRectangles();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < file_list.size(); i++) {
try{
int count = collection.get(i).size();
if (count > 0) {
sb.append(file_list.get(i).getPath() + " "); // Add the
// filename of
// the file
sb.append(count + " "); // Add the number of rectangles
for (int j = 0; j < collection.get(i).size(); j++) {
Rectangle current = collection.get(i).get(j);
String coordinates = (int) current.getMinX() + " "
+ (int) current.getMinY() + " ";
String size = ((int) current.getMaxX() - (int) current
.getMinX())
+ " "
+ ((int) current.getMaxY() - (int) current
.getMinY()) + " ";
String result = coordinates + size;
sb.append(result);
sb.append(newline);
} catch (NullPointerException e){
// Do nothing. "int count = collection.get(i).size();"
// will try to over count.
return sb.toString();
private boolean isImage(File f) {
List<String> list = Arrays.asList(filetypes);
String extension = getExtension(f);
if (list.contains(extension)) {
return true;
return false;
/** Draw the image on the panel. * */
public void paint(Graphics g) {
if (currentImage == null) {
g.drawString("No image to display!", 300, 240);
} else {
// Draw the image
g.drawImage(currentImage, 0, 0, this);
// Write the index
g.setFont(big);
g.drawString(index + 1 + "/" + file_list.size(), 10, 25);
public void nextImage() throws IOException {
if (index < file_list.size() - 1) {
printOutContents();
System.out.println("Index: " + index);
saveRectangles();
index++;
currentImage = ImageIO.read(file_list.get(index));
this
.setSize(currentImage.getWidth(),
currentImage.getHeight() + 55);
top.setSize(this.getSize());
top.rectangle_list.clear();
if (collection.size() > index) {
loadRectangles();
repaint();
private void saveRectangles() {
// If the current image's rectangles have not been changed, don't do
// anything.
if (collection.containsKey(index)) {
System.out.println("Removing Index: " + index);
collection.remove(index);
collection.put(index, top.getRectangleList());
System.out.println("We just saved " + collection.get(index).size()
+ " rectangles");
System.out.println("They were saved in HashMap Location " + index);
System.out.println("Proof: ");
List<Rectangle> temp = collection.get(index);
for (int i = 0; i < temp.size(); i++) {
System.out.println("Rectangle " + (i + 1) + ": " + temp.get(i));
// If the rectangle list has changed, set the list the current index
// as the new list.
private void loadRectangles() {
System.out.println("We just loaded index " + index
+ " into temporary memory.");
System.out.println("Proof: ");
List<Rectangle> temp = collection.get(index);
top.rectangle_list = collection.get(index);
for (int i = 0; i < temp.size(); i++) {
System.out.println("Rectangle " + (i + 1) + ": " + temp.get(i));
private void printOutContents() {
System.out.println();
System.out.println("Contents printout...");
for (int i = 0; i < collection.size(); i++) {
for (Rectangle r : collection.get(i)) {
System.out.println("In collection index: " + i + " Rectangle "
+ r.toString());
System.out.println();
public void previousImage() throws IOException {
if (index >= 1) {
printOutContents();
System.out.println("Index: " + index);
saveRectangles();
index--;
currentImage = ImageIO.read(file_list.get(index));
this
.setSize(currentImage.getWidth(),
currentImage.getHeight() + 55);
top.setSize(this.getSize());
top.rectangle_list.clear();
if (index >= 0) {
loadRectangles();
repaint();
public void removeLastRectangle() {
// This method removes the most recent rectangle added.
try {
int length = collection.get(index).size();
collection.get(index).remove(length - 1);
} catch (NullPointerException e) {
try {
top.rectangle_list.remove(top.rectangle_list.size() - 1);
} catch (IndexOutOfBoundsException ioobe) {
JOptionPane.showMessageDialog(this, "Cannot undo any more!");
* Class developed from SSCCE found on Java forum:
* http://forum.java.sun.com/thread.jspa?threadID=647074&messageID=3817479
* @author 74philip
class TopPanel extends JPanel {
List<Rectangle> rectangle_list;
private static final long serialVersionUID = 6208367976334130998L;
Point loc;
int width, height, arcRadius;
Rectangle temp; // for mouse ops in TopRanger
public TopPanel() {
setOpaque(false);
rectangle_list = Collections
.synchronizedList(new LinkedList<Rectangle>());
TopRanger ranger = new TopRanger(this);
addMouseListener(ranger);
addMouseMotionListener(ranger);
public List<Rectangle> getRectangleList() {
List<Rectangle> temporary = Collections
.synchronizedList(new LinkedList<Rectangle>());
temporary.addAll(rectangle_list);
return temporary;
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(Color.red);
// Draw all the rectangles in the rectangle list.
for (int i = 0; i < rectangle_list.size(); i++) {
g2.drawRect(rectangle_list.get(i).x, rectangle_list.get(i).y,
rectangle_list.get(i).width, rectangle_list.get(i).height);
if (temp != null) {
g2.draw(temp);
public void loadRectangleList(List<Rectangle> list) {
rectangle_list.addAll(list);
public void addRectangle(Rectangle r) {
rectangle_list.add(r);
class TopRanger extends MouseInputAdapter {
TopPanel top;
Point offset;
boolean dragging;
public TopRanger(TopPanel top) {
this.top = top;
dragging = false;
public void mousePressed(MouseEvent e) {
Point p = e.getPoint();
top.temp = new Rectangle(p, new Dimension(0, 0));
offset = new Point();
dragging = true;
top.repaint();
public void mouseReleased(MouseEvent e) {
dragging = false;
// update top.r
System.out.println(top.getRectangleList().size() + ": Object added: "
+ top.temp.toString());
top.addRectangle(top.temp);
top.repaint();
public void mouseDragged(MouseEvent e) {
if (dragging) {
top.temp.setBounds(top.temp.x, top.temp.y, e.getX() - top.temp.x, e
.getY()
- top.temp.y);
top.repaint();
}Regards,
EricAlright so I fixed it! I created a new class called BottomPanel extends JPanel, which I then gave the responsibility of drawing the image. I gave it an update method which took the details of the currentImage and displayed it on the screen.
If anybody's interested I also discovered/solved a problem with my mouseListener - I couldn't drag backwards. I fixed this by adding tests looking for negative widths and heights. I compensated accordingly by reseting the rectangle origin to e.getX(), e.getY() and by setting the to original_origin.x - e.getX() and original_origin.y - e.getY().
No problem! -
[InDesign CS3] how to find the reason of the memory leaks?
Hi all,
I'm working with InDesign CS3. I wrote a plug-in and loaded it into InDesign in debug mode. After I closed the application, I got a console window showing memory leaks as following:
Leaks! 52 leaks, 716804 bytes
Press any key to continue . . .
Does anybody know how to find the reason of the memory leaks? Thanks a lot!
NicoleThanks Dave. I'm using Windows, and I also tried MemoryTracker. I got a Leaks.txt which shows the detail of memory leaks as following. But I really can't understand it. Any help? Thanks.<br /><br />Leaks! 7 leaks, 455252 bytes<br /><br />65036 bytes at: 7B22FF8<br /> 4172627C MemoryPool::GetNonPoolSizePeak cannot be found in any module!<br /> 00EDC1CB K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 01C9C74F cannot find address in any module!<br /> 01C96DEC BIBGetVersion cannot be found in any module!<br /> 01C96E60 BIBGetVersion cannot be found in any module!<br /> 01C979E4 cannot find address in any module!<br /> 0131F511 K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 0131F4C4 K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 00EDBC7E K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 00EDBFBE K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 00EDC558 K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 1002C26E cannot find address in any module!<br /> 1002BFB9 cannot find address in any module!<br /> 00401644 cannot find address in any module!<br /> 00405146 cannot find address in any module!<br /> 00404EBD cannot find address in any module!<br /> 7C817067 RegisterWaitForInputIdle cannot be found in any module!<br />65036 bytes at: 7B32E38<br /> 4172627C MemoryPool::GetNonPoolSizePeak cannot be found in any module!<br /> 00EDC1CB K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 01C9C74F cannot find address in any module!<br /> 01C96DEC BIBGetVersion cannot be found in any module!<br /> 01BB149B cannot find address in any module!<br /> 01BB4C62 cannot find address in any module!<br /> 00EDBCE3 K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 00EDBFBE K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 00EDC558 K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 1002C26E cannot find address in any module!<br /> 1002BFB9 cannot find address in any module!<br /> 00401644 cannot find address in any module!<br /> 00405146 cannot find address in any module!<br /> 00404EBD cannot find address in any module!<br /> 7C817067 RegisterWaitForInputIdle cannot be found in any module!<br />65036 bytes at: 7B52AB8<br /> 4172627C MemoryPool::GetNonPoolSizePeak cannot be found in any module!<br /> 00EDC1CB K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 01C9C74F cannot find address in any module!<br /> 01C96DEC BIBGetVersion cannot be found in any module!<br /> 02331A7A cannot find address in any module!<br /> 0236E7CD cannot find address in any module!<br /> 43726F6C cannot find address in any module!<br />65036 bytes at: 7C93D80<br /> 4172627C MemoryPool::GetNonPoolSizePeak cannot be found in any module!<br /> 00EDC1CB K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 01C9C74F cannot find address in any module!<br /> 02331F36 cannot find address in any module!<br /> 02367F85 cannot find address in any module!<br /> 02415DB4 cannot find address in any module!<br /> 3F800000 cannot find address in any module!<br /> 02416799 cannot find address in any module!<br /> FFFFFF11 cannot find address in any module!<br />65036 bytes at: 7CD6028<br /> 4172627C MemoryPool::GetNonPoolSizePeak cannot be found in any module!<br /> 00EDC1CB K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 01C9C74F cannot find address in any module!<br /> 01CE1C14 cannot find address in any module!<br /> 01DD9346 CTGetVersion cannot be found in any module!<br /> 01D9B052 CTGetVersion cannot be found in any module!<br /> 01D9B189 CTGetVersion cannot be found in any module!<br /> 01D9BB21 CTGetVersion cannot be found in any module!<br /> 01D9BD0C CTGetVersion cannot be found in any module!<br /> 01D9CE96 CTGetVersion cannot be found in any module!<br /> 01D9CEFF CTGetVersion cannot be found in any module!<br /> 01DDBEA2 CTGetVersion cannot be found in any module!<br /> 01DDC214 CTGetVersion cannot be found in any module!<br /> 01DDC7C6 CTGetVersion cannot be found in any module!<br />65036 bytes at: 16D68200<br /> 4172627C MemoryPool::GetNonPoolSizePeak cannot be found in any module!<br /> 00EDC1CB K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 01C9C74F cannot find address in any module!<br /> 01BB178C cannot find address in any module!<br /> 01BCE7C8 cannot find address in any module!<br /> 01BCEE13 cannot find address in any module!<br /> 01BD28C5 cannot find address in any module!<br /> 01BD4CB7 cannot find address in any module!<br />65036 bytes at: 20B68F88<br /> 4172627C MemoryPool::GetNonPoolSizePeak cannot be found in any module!<br /> 00EDC1CB K2Internals::K2VectorBase<HolderPtr<IPMUnknown>,K2Allocator<HolderPtr <IPMUnknown> > >::fill_insert cannot be found in any module!<br /> 01C9C74F cannot find address in any module!<br /> 01CE1C14 cannot find address in any module!<br /> 01D2F1A1 cannot find address in any module!<br /> 01D6F789 CTGetVersion cannot be found in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!<br /> 07BFB464 cannot find address in any module!
-
Anyone spot the problem with this program???
Everytime I compile part of my program it keeps on saying....
"missing return statement
^
1 error"
can anyone spot it on my program???
//GAME
public class Game2 extends MyPrint
GameInterface gameInt;
String s = "?123456789";
Player player1;
Player player2;
public Game2() // Constructor
public int makeMove()
gameInt = new GameInterface ();
player1 = new Player ();
player2 = new Player ();
myPrintln("Enter name of player");
String FP = c.input.readString();
myPrintln(FP, SYSTEM);
myPrintln("Enter name of other player");
String SP = c.input.readString();
myPrintln(SP, SYSTEM);
gameInt.pictureBoard(s);
myPrintln("");
//boolean whoWon=false;
int loop = 0;
while(loop<=6)
player1.setName(FP);
myPrintln(player1.getName() + " (X) to play");
char name1 = c.input.readChar();
name1 = c.input.readChar();
boolean playTurn = true;
gameInt.play(name1, true);
gameInt.pictureBoard(gameInt.display());
myPrintln("");
player2.setName(SP);
myPrintln(player2.getName() + " (O) to play");
char name2 = c.input.readChar();
name2 = c.input.readChar();
playTurn = false;
gameInt.play(name2, false);
gameInt.pictureBoard(gameInt.display());
myPrintln("");
loop++;
cheers
DaveChange public int makeMove() into: public void makeMove()
and the compiler will keep quiet (or finds more things to complain about) -
How to define the memory leak in stability test
Hi
Usually, we run our system with 70% CPU load for 72 hours for stability test (on solaris 10), because some plugin of our system is using mtmalloc, and we use prstat to monitor the memory of each plugin. But because of the complex memory usage of our application, we don't know when the application will use the Max memory, and because of the "mtmalloc", the memory showed by "prstat" will not released but continually increased.
So fro the test point of view, there is the risk of memory leak, but actually, there may be no memory leak, so my question is how to define the memory leak in such condition.kevin wrote:
Thank you for the input and all the info.
isn't java heap the same as memory allocated to the java process in my weblogic
starup script ?The heap is sized by the -Xmx and -Xms parameters you pass on the java
command-line. The permanent generation is separate.
>
let me also download jprobe and try to run it and see what it gives me.
I'd start by running with -verbose:gc. I'd want to know whether you're
running out of heap or permgen space.
-- Rob
kevin
Rob Woollen <[email protected]> wrote:
Unfortunately memory leaks are not fun to track down even with tools.
I'd first suggest determining whether you're running out of space in
the
permanent area (where classes are loaded), or you've exhausted the java
help space.
I'd start by adding -verbose:gc. Look at the gc messages right before
you hit the OutOfMemoryError. If there's plenty of space left, I'd
suspect you're running out of perm space. Search these newsgroups and
the web for MaxPermSize, and you should see plenty of info.
If you're running out of java heap, tools like jprobe and OptimizeIt
are
helpful. If you can tell me a little more about your application and
how you're testing it, I can offer some more tips.
-- Rob
kevin wrote:
Iam new to JAVA and weblogic. I have an application that runs out ofmemory time
and again.
please let me know how to pin point this problem and moreover, howto interpret
or understand that there is a problem. I have downloaded JPROFILE tool,but it
is very confusing to understand what is goin on in this tool.
If somebody can let me know how to interpret and understand the memoryleak, that
will be great !!!
thank you. -
Whether our application caused the memory leak
whether have the command to find out whether our application caused the memory leak !
We are using Jdev10g + JHeadstart(Release 9.0.5.1, BC4J + Struts + JSP) to build our enterprise application,
but when the application running some days in our Application Server(RedHat AMD64, with 8GB RAM), the memory consumed was growth seriously in production environment (one OC4J instance will caused almost 2G memory ulilization after running 2 days) that is caused us to restart the instance each day ! we doubt and worry
about maybe our application suffer the memory leak problem, so we want to know have the command to find out whether our application caused the memory leak
issue and which program is the major murderer for memory.Ting,
Unfortunately there is no 'command' that will show you the location of a memory leak. First I would scrutinizing your code for any obvious 'leaks'. Then, you should obtain some statistics about the usage of your system. One important aspect is how long a HttpSession usually lives. If you have thousands of users that stay online the entire day and never 'time out', and if you have users on the system 24 hours a day, then the sheer number of HttpSessions might be a problem.
JHeadstart 9.0.x tends to have rather 'heavy' session objects. This can easily be solved by adding some actions to clear up DataObjects and DataObjectSets of previous 'Groups' when entering a new Group. A good place would be between the 'DynamicActionRouter' and the 'ActionRouters'. Just before entering the 'EmployeeActionRouter', you could remove all DataObjects and DataObjectSets that might be left on the Session by actions of the other ActionRouters.
Also it would be interesting to see if the garbage collector can do its thing when the system is less busy. For instance, if your application has a smaller load during the weekend, what is the memory usage on Sunday at midnight compared to, say, Friday at noon. Has the memory load dropped consistently with the decreased number of online users, or does too much memory stay allocated? If so, then there's more going on than just HttpSession objects.
If all this does not lead to a solution, I suggest using a profiling tool such as OptimizeIt to investigate the memory usage of the application in detail.
Kind regards,
Peter Ebell
JHeadstart Team
Maybe you are looking for
-
Error while Terminating the Benefits Participation
Hi Frieds, Our system is behaving veri differently. While terminating the Benefits participation we get an error "Organizational Assignment infotype does not exist for 07/01/2011". While in Qulaity server this is succesfuly processed. All the master
-
I went through and did the download process and it only downloaded half of my Creative Suite 6. I REALLY need Acrobat X Pro for a project!!!
-
Net Install, Creating and Preserving User Names & Prefs
Hi I have 10.3.9 Server and a few 10.3.9 and 10.4.9 clients with iMacs, eMacs, Macbooks etc. I would like to install (not boot) from the server but I cant find much info about it except the Help which doesnt cover my question which is: 1. How do I cr
-
Cloudscape - JSP - Unable to create database CloudscapeDB
I created a Cloudscape database in a Java program: try { Class.forName(COM.cloudscape.core.JDBCDriver).newInstance(); connection = DriverManager.getConnection(jdbc:cloudscape:CloudscapeDB;create=true); A CloudscapeDB directory is automatically
-
Hello guys, I'm having an issue with importing full database from one database(machine 1) to another database (machine2). I am getting errors that users don't exist, datafile cannot be read etc errors. I'm using Windows, and Oracle 9.2.0.6 How can I