Results 1 to 4 of 4
  1. #1
    stonkers is offline Member
    Join Date
    Jul 2007
    Posts
    4
    Rep Power
    0

    Default Java Heap Out of Memory Error

    I'm running a vbscript that uses a java sdk to gather information. It's throwing a Java Heap out of memory error. I know how to assign memory to a java app, but how can I assign it to a vbscript. Can I do so inside the code?

    Thanks,
    Eric

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

    Default

    How do you access JDK from vbscript? If we know that, we might be able to help..

  3. #3
    stonkers is offline Member
    Join Date
    Jul 2007
    Posts
    4
    Rep Power
    0

    Default

    Not the JDK, the Borland StarTeam SDK. Here's what it does conceptually (StarTeam SDK Link) Here's most of the code (I stopped short because of the 10,000 char thread limitation):

    Java Code:
    '--------------------------------------------
    ' $Workfile: AccessRights.vbs$
    ' $Author: Steven Lange$
    ' $Date: 8/4/2000 6:50:37 AM$
    ' $Revision: 11$
    ' Requirements:  
    '          - StarGateSDK
    '          - Windows Scripting Host
    '--------------------------------------------
    
    Dim strServer, nPort, strFileName
    Dim strUser, strPassword
    
    ' ~~~ Modify these values for your needs ~~~ '
    
    strAddress = "myServerName"
    nPort = 49201
    
    strUser = "Administrator"
    strPassword = "MyAdminPassword"
    
    strFileName = "AccessRights.txt"
    
    
    ' ~~~ Don't modify below here! ~~~ '
    
    ' Check for command-line parameters
    ' server address
    If (WScript.Arguments.Count > 0) Then
    	strAddress = WScript.Arguments(0)
    End If
    
    ' server port
    If (WScript.Arguments.Count > 1) Then
    	nPort = CInt(WScript.Arguments(1))
    End If
    
    ' user name
    If (WScript.Arguments.Count > 2) Then
    	strUser = WScript.Arguments(2)
    End If
    
    ' password
    If (WScript.Arguments.Count > 3) Then
    	strPassword = WScript.Arguments(3)
    End If
    
    'filename
    If (WScript.Arguments.Count > 4) Then
    	strFileName = WScript.Arguments()
    End If
    
    ' Grant or Deny?
    Function GD(ByVal granted)
    	if Granted = True then
    		GD = "Grant"
    	else
    		GD = "Deny"
    	end if
    End Function
    
    ' Get Name of User or Group.
    Function getName(ByVal id, ByVal isGroup)
    	if isGroup = True then
    		getName = StServer.Administration.findGroupAccount(id).Name
    	else
    		getName = StServer.Administration.findUserAccount(id).Name
    	end if
    End Function
    
    ' Write the access rights entries.
    Sub WriteACL(ByVal list, ByVal p,ByVal aType)
    	dim e
    	For e = 0 to list.Count-1
    		FileObj.WriteLine(Space(8) & e+1 & ". " & GD(list(e).Granted) & " - " & getName(list(e).id,list(e).GroupID))
    		Select Case aType	'0=server,1=project,2=view,3=folder
    		Case 0	' server
    			PServer list(e),p
    		Case 1	' project
    			PGeneric list(e),p
    			PItem list(e),p
    		Case 2	' view
    			PGeneric list(e),p
    			PItem list(e),p
    		Case Else	' other
    			PGeneric list(e),p		
    			PItem list(e),p
    		End Select
    	next
    End Sub
    
    ' Write the permissions
    
    Sub PGeneric(ByVal entry,ByVal p)
    	if entry.hasPermission(p.GENERIC_AQUIRE_OWNERSHIP) then
    		FileObj.Write(Space(13) & "- Acquire Object Ownership" & VbCrLf)
    	end if
    	if entry.hasPermission(p.GENERIC_CHANGE_ACCESS_RIGHTS) then
       		FileObj.Write(Space(13) & "- Modify Security Settings" & VbCrLf)
    	end if
    	if entry.hasPermission(p.GENERIC_CREATE_NEW_OBJECT) then
       		FileObj.Write(Space(13) & "- Create New Object" & VbCrLf)
    	end if
    	if entry.hasPermission(p.GENERIC_DELETE_OBJECT) then
       		FileObj.Write(Space(13) & "- Delete Object" & VbCrLf)
    	end if
    	if entry.hasPermission(p.GENERIC_MODIFY_OBJECT) then
       		FileObj.Write(Space(13) & "- Modify Object Properties" & VbCrLf)
    	end if
    	if entry.hasPermission(p.GENERIC_PURGE_OBJECT) then
       		FileObj.Write(Space(13) & "- Purge Object" & VbCrLf)
    	end if
    	if entry.hasPermission(p.GENERIC_SEE_OBJECT) then
       		FileObj.Write(Space(13) & "- See Object and its Properties" & VbCrLf)
    	end if
    End Sub
    
    Sub PServer(ByVal entry,ByVal p)
    	if entry.hasPermission(p.SERVER_ADMIN_REMOTELY) then
       		FileObj.Write(Space(13) & "- Remotely Administer Server" & VbCrLf)
    	end if
    	if entry.hasPermission(p.SERVER_ADMIN_USER_ACCOUNTS) then
       		FileObj.Write(Space(13) & "- Administer User Accounts" & VbCrLf)
    	end if
    	if entry.hasPermission(p.SERVER_CREATE_PROJECT) then
       		FileObj.Write(Space(13) & "- Create New Project" & VbCrLf)
    	end if
    	if entry.hasPermission(p.SERVER_MODIFY_CONFIGURATION) then
       		FileObj.Write(Space(13) & "- Modify Server Configuration" & VbCrLf)
    	end if
    	if entry.hasPermission(p.SERVER_MODIFY_SCHEMA) then
       		FileObj.Write(Space(13) & "- Modify Database Schema" & VbCrLf)
    	end if
    	if entry.hasPermission(p.SERVER_MODIFY_SYSTEM_POLICY) then
       		FileObj.Write(Space(13) & "- Modify System Policy" & VbCrLf)
    	end if
    	if entry.hasPermission(p.SERVER_VIEW_CONFIGURATION) then
       		FileObj.Write(Space(13) & "- View Server Configuration" & VbCrLf)
    	end if
    	if entry.hasPermission(p.SERVER_VIEW_DIAGNOSTICS) then
       		FileObj.Write(Space(13) & "- View Server Diagnostics" & VbCrLf)
    	end if
    	if entry.hasPermission(p.SERVER_VIEW_LOG) then
       		FileObj.Write(Space(13) & "- View Server Log" & VbCrLf)
    	end if
    	if entry.hasPermission(p.SERVER_VIEW_SECURITY_LOG) then
       		FileObj.Write(Space(13) & "- View Server Security Log" & VbCrLf)
    	end if
    	if entry.hasPermission(p.SERVER_VIEW_SYSTEM_POLICY) then
       		FileObj.Write(Space(13) & "- View System Policy" & VbCrLf)
    	end if
    End Sub
    
    Sub PView(ByVal entry,ByVal p)
    	if entry.hasPermission(p.VIEW_CREATE_LABEL) then
       		FileObj.Write(Space(13) & "- Create Label" & VbCrLf)
    	end if
    	if entry.hasPermission(p.VIEW_DEFINE_PROMOTION_MODEL) then
       		FileObj.Write(Space(13) & "- Define Promotion Model" & VbCrLf)
    	end if
    	if entry.hasPermission(p.VIEW_DELETE_LABEL) then
       		FileObj.Write(Space(13) & "- Delete Label" & VbCrLf)
    	end if
    	if entry.hasPermission(p.VIEW_EDIT_LABEL) then
       		FileObj.Write(Space(13) & "- Modify Label" & VbCrLf)
    	end if
    	if entry.hasPermission(p.VIEW_MODIFY_PROMOTION_STATUS) then
       		FileObj.Write(Space(13) & "- Modify Promotion Status" & VbCrLf)
    	end if
    End Sub
    
    Sub PItem(ByVal entry,ByVal p)
    	if entry.hasPermission(p.FILE_CHECKIN) then
    		FileObj.Write(Space(13) & "- Check In File" & VbCrLf)
    	end if
    	if entry.hasPermission(p.FILE_CHECKOUT) then
    		FileObj.Write(Space(13) & "- Check Out File" & VbCrLf)
    	end if
    	if entry.hasPermission(p.ITEM_ADD_LABEL) then
       		FileObj.Write(Space(13) & "- Create New Label" & VbCrLf)
    	end if
    	if entry.hasPermission(p.ITEM_ADJUST_LABEL) then
       		FileObj.Write(Space(13) & "- Adjust Label" & VbCrLf)
    	end if
    	if entry.hasPermission(p.ITEM_BREAK_EXCLUSIVE_LOCK) then
       		FileObj.Write(Space(13) & "- Break Exclusive Lock" & VbCrLf)
    	end if
    	if entry.hasPermission(p.ITEM_CREATE_LINKS) then
       		FileObj.Write(Space(13) & "- Create Links" & VbCrLf)
    	end if
    	if entry.hasPermission(p.ITEM_DELETE_LINKS) then
       		FileObj.Write(Space(13) & "- Delete Links" & VbCrLf)
    	end if
    	if entry.hasPermission(p.ITEM_DETACH_LABEL) then
       		FileObj.Write(Space(13) & "- Detach Label" & VbCrLf)
    	end if
    	if entry.hasPermission(p.ITEM_LOCK_EXCLUSIVELY) then
       		FileObj.Write(Space(13) & "- Set Exclusive Lock" & VbCrLf)
    	end if
    	if entry.hasPermission(p.ITEM_MODIFY_BEHAVIOR) then
       		FileObj.Write(Space(13) & "- Modify Item Behavior" & VbCrLf)
    	end if
    	if entry.hasPermission(p.ITEM_MODIFY_LINKS) then
       		FileObj.Write(Space(13) & "- Modify Links" & VbCrLf)
    	end if
    	if entry.hasPermission(p.ITEM_PERFORM_MAINTENANCE) then
       		FileObj.Write(Space(13) & "- Perform Item Maintenance" & VbCrLf)
    	end if
    	if entry.hasPermission(p.ITEM_SEE_HISTORY) then
       		FileObj.Write(Space(13) & "- See History" & VbCrLf)
    	end if
    	if entry.hasPermission(p.ITEM_SEE_LINKS) then
       		FileObj.Write(Space(13) & "- See Links" & VbCrLf)
    	end if
    	if entry.hasPermission(p.ITEM_SHARE_MOVE) then
       		FileObj.Write(Space(13) & "- Share/Move Items" & VbCrLf)
    	end if
    End Sub
    
    ' Write a string of characters.
    Sub FillChars(ByVal ch,ByVal length)
    	dim x
    	for x = 1 to length
    		FileObj.Write(ch)
    	next
    	FileObj.Write(vbCrLf)
    End Sub
    
    ' Write the report header.
    Sub WriteHeader()
    	FillChars "=",70
    	FileObj.WriteLine("STARTEAM ACCESS RIGHTS REPORT")
    	FillChars "=",70
    	FileObj.WriteBlankLines(1)
    	FileObj.WriteLine("KEY: Project::ViewPath::FolderPath" & vbCrLf)
    	FileObj.WriteLine("** This report was run against StarTeam Server: " & strAddress & ":" & nPort & vbCrLf)
    End Sub
    
    ' Write the report footer.
    Sub WriteFooter()
    	FillChars "-",70
    	FileObj.WriteLine("END REPORT" & Space(60-Len(Now())) & Now())
    	FillChars "-",70
    End Sub
    
    Function CheckforACL(myACL)
    	if UCase(TypeName(myACL)) <> "NOTHING" then
    		CheckforACL = True
    	else
    		CheckforACL = False
    	end if
    End Function
    
    ' Enumerate through the projects.
    Sub EnumProjects(ByVal StServer)
    	dim proj
    	for each proj in StServer.Projects
    		found = false
    		if CheckforACL(proj.acl) = true then
    			if found = false then
    				FileObj.WriteLine(proj.Name)
    				found = true
    			end if
    			FileObj.WriteLine(Space(5) & "*" & cons(0))
    			WriteACL proj.acl,p,1
    		end if
    		for c = 1 to 6
    			if CheckforACL(proj.getContainerLevelACL(cons(c))) = true then
    				if found = false then
    					FileObj.WriteLine(proj.Name)
    					found = true
    				end if
    				FileObj.WriteLine(Space(5) & "*" & cons(c) & "s:")
    				WriteACL proj.getContainerLevelACL(cons(c)),p,c+1
    			end if
    		next
    		EnumViews proj
    		FileObj.WriteBlankLines(1)	
    	next
    End Sub
    Thanks for the reply!
    Eric

  4. #4
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

    Default

    As far as i understand your problem your problem is not related to JDK but related to StarTeam SDK. I think you should ask this on their support forums/email lists ... At least i dont know the answer. Good luck.

Similar Threads

  1. JVm Heap memory settings
    By nagesh in forum Advanced Java
    Replies: 2
    Last Post: 09-17-2009, 05:47 PM
  2. Heap Sort in Java
    By Java Tip in forum Algorithms
    Replies: 0
    Last Post: 04-16-2008, 10:27 PM
  3. Low memory error
    By rlhs76 in forum New To Java
    Replies: 2
    Last Post: 02-08-2008, 10:25 PM
  4. JVM Heap memory settings
    By nagesh in forum New To Java
    Replies: 1
    Last Post: 08-11-2007, 10:17 PM
  5. How to reduce the size or avoiding out of memory error?
    By rajeshkumarmsc in forum Advanced Java
    Replies: 3
    Last Post: 08-11-2007, 10:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •