Search Results

Search found 19301 results on 773 pages for 'hyper v dynamic memory'.

Page 15/773 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Newbie one: Virtual Networks - Hyper-V - Remote Destktop - Only one phisical NIC

    - by josecortesp
    Hello everyone, I'll try to explain my situation and I'll apreciate any help: I have a phisical server (quad core, 4Gb ram, 1TB raid 10, etc) with Win Server 2008 R2 enterprise, running IIS, Printing, etc... Also, I want to set up 2 virtual Servers with 2008 R2 standart one with SQL Server and the other with Team Foundation. What i need is: Being able to access from inside the private phisical network, to Remote Desktops on each of the Virtual and the phisical Servers Had Access from the outside, using a router and port Forwarding, to the TFS server and the IIS server (one is virtualized, the other is phisical) This is it, but note that I only have one Phisical Nic. How do I configure this to work. When i set up the hyper-v role, on the wizard something like it showed up but I don't remmember what i choose, and right now, I cannot access none of the servers from remote desktop, not even from the phisical private network. Can anybody point me, what can i do? Thanks in advance (sorry 4 my english, i'm a spanish talker and my english isn't that good)

    Read the article

  • Memory layout of executable

    - by Ross
    Hi all, When loading an executable then segments like the code, data, bss and so on need to be placed in memory. I am just wondering, if someone could tell me where on a standard x86 for example the libc library is placed. Is that at the top or bottom of memory. My guess is at the bottom, close to the application code, ie., that would look something like this here: --------- 0x1000 Stack | V ^ | Heap ---------- Data + BSS ---------- App Code ---------- libc ---------- 0x0000 Thanks a lot, Ross

    Read the article

  • Help Finding Memory Leak

    - by Neal L
    Hi all, I am writing an iPad app that downloads a rather large .csv file and parses the file into objects stored in Core Data. The program keeps crashing, and I've run it along with the Allocations performance tool and can see that it's eating up memory. Nothing is alloc'ed or init'ed in the code, so why am I gobbling up memory? Code at: http://pastie.org/955960 Thanks! -Neal

    Read the article

  • Hyper-v error starting vm after reboot

    - by mamu
    Hi rebooted hyper-v host running server 2008 r2. After reboot one of my vm is throwing following error. 'The version does not support this version of file format' Out of my all vms this was only set to save state when shutdown. I tried deleting state and start still same error. Tried inspect disk as well edit disk both throw same error when try to open this. What could it be? any way to resolve it?

    Read the article

  • Hyper-V and custom resolution

    - by Thomas Levesque
    I know this question has been asked many times (here and on TechNet), and the answer is usually "use RDP". But apparently, RDP is now the only option, and it's what I'm using. My screen is an LCD TV with a resolution of 1360x768. Unfortunately, this resolution is apparently not supported; the closest I can get in a Windows 8 VM is 1366x768, and it adds scrollbars, which make it difficult to put the mouse in the corners to get at the start screen and charm bar... Smaller resolutions don't fill the screen, so it's also difficult to put the mouse in the corner. Is there a way to set a custom resolution to fit my screen exactly ? (note: I know it's not a Windows 8 problem, since I don't have this problem on my host machine which also runs Windows 8. I assume it's related to the display adapter used by Hyper-V, but there don't seem to be any options to change it)

    Read the article

  • Hyper-V Server hvremote.wsf Script - ns lookup for DNS Verification test fails

    - by Vazgen
    I'm trying to connect my Hyper-V Server to a Windows 8 client for remote management. I have: Joined server to WORKGROUP Enabled Remote Management Set the server name Set a static IP Set the DNS servers to my ISPs DNS Servers (same as default DNS Servers on my Windows 8 remote management client) Set the correct time zone Created net user on server (net user /add admin password) Added user to special Administrators group on server (hvremote /add:admin) Granted anonymous dcom access on client using hvremote However, the "ns lookup for DNS verification" fails on both the client and server with the same error: Server: my.isps.server.name.net Address: 111.222.333.1 *** my.isps.server.name.net can't find 192.168.1.3: Non-existent domain Thanks for the help.

    Read the article

  • Please help with iPhone Memory & Images, memory usage crashing app

    - by Andrew Gray
    I have an issue with memory usage relating to images and I've searched the docs and watched the videos from cs193p and the iphone dev site on memory mgmt and performance. I've searched online and posted on forums, but I still can't figure it out. The app uses core data and simply lets the user associate text with a picture and stores the list of items in a table view that lets you add and delete items. Clicking on a row shows the image and related text. that's it. Everything runs fine on the simulator and on the device as well. I ran the analyzer and it looked good, so i then starting looking at performance. I ran leaks and everything looked good. My issue is when running Object Allocations as every time i select a row and the view with the image is shown, the live bytes jumps up a few MB and never goes down and my app eventually crashes due to memory usage. Sorting the live bytes column, i see 2 2.72MB mallocs (5.45Mb total), 14 CFDatas (3.58MB total), 1 2.74MB malloc and everything else is real small. the problem is all the related info in instruments is really technical and all the problem solving examples i've seen are just missing a release and nothing complicated. Instruments shows Core Data as the responsible library for all but one (libsqlite3.dylib the other) with [NSSQLCore _prepareResultsFromResultSet:usingFetchPlan:withMatchingRows:] as the caller for all but one (fetchResultSetReallocCurrentRow the other) and im just not sure how to track down what the problem is. i've looked at the stack traces and opened the last instance of my code and found 2 culprits (below). I havent been able to get any responses at all on this, so if anyone has any tips or pointers, I'd really appreciate it!!!! //this is from view controller that shows the title and image - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.title = item.title; self.itemTitleTextField.text = item.title; if ([item.notes length] == 0) { self.itemNotesTextView.hidden = YES; } else { self.itemNotesTextView.text = item.notes; } //this is the line instruments points to UIImage *image = item.photo.image; itemPhoto.image = image; } - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { // Delete the managed object for the given index path NSManagedObjectContext *context = [fetchedResultsController managedObjectContext]; [context deleteObject:[fetchedResultsController objectAtIndexPath:indexPath]]; // Save the context. NSError *error = nil; if (![context save:&error]) //this is the line instruments points to { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); exit(-1); } } }

    Read the article

  • Freeing memory twice

    - by benjamin button
    Hi, AFAIK, freeing a NULL pointer will result in nothing. I mean nothing is being done by the compiler/no functionality is performed. Still, I do see some statements where people say that one of the scenarios where memory corruption can occur is "freeing memory twice"? Is this still true?

    Read the article

  • Hyper-V shutdown/start up host causing issues in VMs

    - by Colin Desmond
    I have a single physical host, running 2008 R2 with Hyper-V, all fully updated. On that host I am running 3 clients, a DC, a web server and a SQL Server 2008 R2 SP1. All are running on Windows Server 2008 R2, again all fully patched. Generally all is fine, but sometimes and not repeatably, when I shutdown the host properly, which suspends the Clients, when it all comes up again, SQL Server is no longer running and the IIS App Pool I am running the website in needs to be told which account to run in again! Any ideas!?

    Read the article

  • Can a virtual mikrotik box bridge a hyper-v internal network with a hyper-v external network?

    - by mcfrosty
    I am trying to set up a Mikrotik router as a transparent firewall on my network. I got the machine working on a hardware MT box, but my boss wants the MT virtualized. I have been trying the set up where my virtual windows box talks to the Mikrotik via private or internal network on the Hyper-V host. I can get the two machines to talk, but as soon as I set up a bridge on the MT, all traffic ceases between the two. Is it possible to create a bridge for this purpose (having the MT silently in front of my firewalled server)? I could really use some help.

    Read the article

  • Hyper-V CPU Utilization, Good Tools?

    - by yzorg
    I just learned a ton from this post: Host CPU% doesn't include child VM CPU%, specifically I learned that both the 'host OS' and 'child VM' are siblings within the HyperVisor layer. Are there good utilities for 'watching' the total CPU and other resource counters at the HyperVisor (hardware) layer? I know perfmon (watching special Hyper-V CPU counters) is the standard answer, but I've stayed away from perfmon for ad-hoc monitoring. Is there a good OSS or free tools to 'watch' the resource utilization as I create multiple new VMs running on the server? I'm a developer, so if there aren't any good UI tools to surface this data I'd consider creating one, but only if needed. P.S. My specific scenario is I'm creating new web, SQL and back-end server VMs for new Windows 8 Server and SQL 2012 (entire application stack). I need to monitor them for utilization and know when I need to grow beyond 1 host (I'll need to split the VMs into separate hosts as I hit hardware limits of the 1st host, and diagnose problems).

    Read the article

  • Hyper V cluster - one VM won't migrate

    - by Chris W
    We have a Failover Cluster built up on 6 blades, each running Hyper V. Each box is running Server 2008 R2. We've got a number of VMs running that all have the same basic config: VHD stored on a cluster shared volume. 2 virtual NICs (1 for LAN connection and 1 for SAN connection). All of our VMs will happily migrate between any other blade apart from one single VM which is running fine on it's current blade but will not migrate to any other location. What could be the cause of it or where should I look to get a detailed error message as I can't seem to find much information logged in any of the logs. Edit: I know the usual culprit is mis-matching resource names. We've already been there with the NICs named differently on some of the blades. As far as we can tell now everything looks to be identical on each bit of metal.

    Read the article

  • Simulate memory warnings from the code, possible?

    - by krasnyk
    I know i can simulate a memory warning on the simulator by selecting 'Simulate Memory Warning' from the drop down menu of the iPhone Simulator. I can even make a hot key for that. But this is not what I'd like to achieve. I'd like to do that from the code by simply, lets say doing it every 5 seconds. Is that possible?

    Read the article

  • Available memory for iPhone OS app

    - by hgpc
    Is there a function or constant defining the amount of available memory for an app in iPhone OS? I'm looking for a device-independent way (iPod touch, iPhone, iPad) to know how much memory the app has left.

    Read the article

  • SQL Cluster install on Hyper V options

    - by Chris W
    I've been reading up on running a SQL Cluster in a Hyper V environment and there seems to be a couple of options: Install guest cluster on 2 VMs that are themselves part of a fail over cluster. Install SQL cluster on 2 VMs but the VMs themselves are not part of an underlying cluster. With option 1, it's little more complex as there's effectively two clusters in play but this adds some flexibility in the sense that I'm free to migrate the VMs between and physical blades in their cluster for physical maintenance without affecting the status of the SQL guest cluster that's running within them. With option 2, the set-up is a bit simpler as there's only 1 cluster in the mix but my VMs are anchored to the physical blades that they're set-up on (I'll ignore the fact I could manually move the VHDs for the purposes of this question). Are there any other factors that I should consider here when deciding which option to go for? I'm free to test out both options and probably will do but if any one has working experience of these set-ups and can offer some input that would be great.

    Read the article

  • No more memory available in Mathematica, Fit the parameters of system of differential equation

    - by user1058051
    I encountered a memory problem in Mathematica, when I tried to process my experimental data. It's a system of two differential equations and I need to find most suitable parameters. Unfortunately I am not a Pro in Mathematica, so the program used a lot of memory, when the parameter epsilon is more than 0.4. When it less than 0.4, the program work properly. The command 'historylength = 0' and attempts to reduce the Accuracy Goal and WorkingPrecision didn`t help. I can't use ' clear Cache ', because there isnt a circle. I'm trying to understand what mistakes I made, and how I may limit the memory usage. I have already bought extra-RAM, now its 4GB, and now I haven't free memory-slots in motherboard Remove["Global`*"]; T=13200; L = 0.085; e = 0.41; v = 0.000557197; q = 0.1618; C0 = 0.0256; R = 0.00075; data = {{L,600,0.141124587},{L,1200,0.254134509},{L,1800,0.342888644}, {L,2400,0.424476295},{L,3600,0.562844542},{L,4800,0.657111356}, {L,6000,0.75137817},{L,7200,0.815876516},{L,8430,0.879823594}, {L,9000,0.900771775},{L,13200,1}}; model[(De_)?NumberQ, (Kf_)?NumberQ, (Y_)?NumberQ] := model[De, Kf, Y] = yeld /.Last[Last[ NDSolve[{ v (Ci^(1,0))[z,t]+(Ci^(0,1))[z,t]== -((3 (1-e) Kf (Ci[z,t]-C0))/ (R e (1-(R Kf (1-R/r[z,t]))/De))), (r^(0,1))[z,t]== (R^2 Kf (Ci[z,t]-C0))/ (q r[z,t]^2 (1-(R Kf (1-R/r[z,t]))/De)), (yeld^(0,1))[z,t]== Y*(v e Ci[z,t])/(L q (1-e)), r[z,0]==R, Ci[z,0]==0, Ci[0,t]==0, yeld[z,0]==0}, {r[z,t],Ci[z,t],yeld},{z,0,L},{t,0,T}]]] fit = FindFit[data, {model[De, Kf, Y][z, t], {Y > 0.97, Y < 1.03, Kf > 10^-6, Kf < 10^-4, De > 10^-13, De < 10^-9}}, {{De,7*10^-13}, {Kf, 10^-5}, {Y, 1}}, {z, t}, Method -> NMinimize] data = {{600,0.141124587},{1200,0.254134509},{1800,0.342888644}, {2400,0.424476295},{3600,0.562844542},{4800,0.657111356}, {6000,0.75137817},{7200,0.815876516},{8430,0.879823594}, {9000,0.900771775},{13200,1}}; YYY = model[ De /. fit[[1]], Kf /. fit[[2]], Y /. fit[[3]]]; Show[Plot[Evaluate[YYY[L,t]],{t,0,T},PlotRange->All], ListPlot[data,PlotStyle->Directive[PointSize[Medium],Red]]] the link on the .nb file http://www.4shared.com/folder/249TSjlz/_online.html

    Read the article

  • How to guard against memory leaks?

    - by just_wes
    I was recently interviewing for a C++ position, and I was asked how I guard against creating memory leaks. I know I didn't give a satisfactory answer to that question, so I'm throwing it to you guys. What are the best ways to guard against memory leaks? Thanks!

    Read the article

  • Server 2008 Hyper-V User Accounts to access each other

    - by asn1981
    Hi, I have a windows server 2008 r2 with 3 hyper-v vm's IIS server Sql server 3 - Mail server I'm new to networking/server configuration. I have created a Virtual Network and can see each of the 3 VMs as well as the host on the network. I can connect from each VM to the host using the admin account. However, what would be the best (secure) way to create connections/accounts between the VMs, presumabely this shouldn't be done with an admin account but one with lesser priveledges. For example, to be able to access the SQL Server VM from the IIS server VM?

    Read the article

  • Creating a dynamic proxy generator – Part 1 – Creating the Assembly builder, Module builder and cach

    - by SeanMcAlinden
    I’ve recently started a project with a few mates to learn the ins and outs of Dependency Injection, AOP and a number of other pretty crucial patterns of development as we’ve all been using these patterns for a while but have relied totally on third part solutions to do the magic. We thought it would be interesting to really get into the details by rolling our own IoC container and hopefully learn a lot on the way, and you never know, we might even create an excellent framework. The open source project is called Rapid IoC and is hosted at http://rapidioc.codeplex.com/ One of the most interesting tasks for me is creating the dynamic proxy generator for enabling Aspect Orientated Programming (AOP). In this series of articles, I’m going to track each step I take for creating the dynamic proxy generator and I’ll try my best to explain what everything means - mainly as I’ll be using Reflection.Emit to emit a fair amount of intermediate language code (IL) to create the proxy types at runtime which can be a little taxing to read. It’s worth noting that building the proxy is without a doubt going to be slightly painful so I imagine there will be plenty of areas I’ll need to change along the way. Anyway lets get started…   Part 1 - Creating the Assembly builder, Module builder and caching mechanism Part 1 is going to be a really nice simple start, I’m just going to start by creating the assembly, module and type caches. The reason we need to create caches for the assembly, module and types is simply to save the overhead of recreating proxy types that have already been generated, this will be one of the important steps to ensure that the framework is fast… kind of important as we’re calling the IoC container ‘Rapid’ – will be a little bit embarrassing if we manage to create the slowest framework. The Assembly builder The assembly builder is what is used to create an assembly at runtime, we’re going to have two overloads, one will be for the actual use of the proxy generator, the other will be mainly for testing purposes as it will also save the assembly so we can use Reflector to examine the code that has been created. Here’s the code: DynamicAssemblyBuilder using System; using System.Reflection; using System.Reflection.Emit; namespace Rapid.DynamicProxy.Assembly {     /// <summary>     /// Class for creating an assembly builder.     /// </summary>     internal static class DynamicAssemblyBuilder     {         #region Create           /// <summary>         /// Creates an assembly builder.         /// </summary>         /// <param name="assemblyName">Name of the assembly.</param>         public static AssemblyBuilder Create(string assemblyName)         {             AssemblyName name = new AssemblyName(assemblyName);               AssemblyBuilder assembly = AppDomain.CurrentDomain.DefineDynamicAssembly(                     name, AssemblyBuilderAccess.Run);               DynamicAssemblyCache.Add(assembly);               return assembly;         }           /// <summary>         /// Creates an assembly builder and saves the assembly to the passed in location.         /// </summary>         /// <param name="assemblyName">Name of the assembly.</param>         /// <param name="filePath">The file path.</param>         public static AssemblyBuilder Create(string assemblyName, string filePath)         {             AssemblyName name = new AssemblyName(assemblyName);               AssemblyBuilder assembly = AppDomain.CurrentDomain.DefineDynamicAssembly(                     name, AssemblyBuilderAccess.RunAndSave, filePath);               DynamicAssemblyCache.Add(assembly);               return assembly;         }           #endregion     } }   So hopefully the above class is fairly explanatory, an AssemblyName is created using the passed in string for the actual name of the assembly. An AssemblyBuilder is then constructed with the current AppDomain and depending on the overload used, it is either just run in the current context or it is set up ready for saving. It is then added to the cache.   DynamicAssemblyCache using System.Reflection.Emit; using Rapid.DynamicProxy.Exceptions; using Rapid.DynamicProxy.Resources.Exceptions;   namespace Rapid.DynamicProxy.Assembly {     /// <summary>     /// Cache for storing the dynamic assembly builder.     /// </summary>     internal static class DynamicAssemblyCache     {         #region Declarations           private static object syncRoot = new object();         internal static AssemblyBuilder Cache = null;           #endregion           #region Adds a dynamic assembly to the cache.           /// <summary>         /// Adds a dynamic assembly builder to the cache.         /// </summary>         /// <param name="assemblyBuilder">The assembly builder.</param>         public static void Add(AssemblyBuilder assemblyBuilder)         {             lock (syncRoot)             {                 Cache = assemblyBuilder;             }         }           #endregion           #region Gets the cached assembly                  /// <summary>         /// Gets the cached assembly builder.         /// </summary>         /// <returns></returns>         public static AssemblyBuilder Get         {             get             {                 lock (syncRoot)                 {                     if (Cache != null)                     {                         return Cache;                     }                 }                   throw new RapidDynamicProxyAssertionException(AssertionResources.NoAssemblyInCache);             }         }           #endregion     } } The cache is simply a static property that will store the AssemblyBuilder (I know it’s a little weird that I’ve made it public, this is for testing purposes, I know that’s a bad excuse but hey…) There are two methods for using the cache – Add and Get, these just provide thread safe access to the cache.   The Module Builder The module builder is required as the create proxy classes will need to live inside a module within the assembly. Here’s the code: DynamicModuleBuilder using System.Reflection.Emit; using Rapid.DynamicProxy.Assembly; namespace Rapid.DynamicProxy.Module {     /// <summary>     /// Class for creating a module builder.     /// </summary>     internal static class DynamicModuleBuilder     {         /// <summary>         /// Creates a module builder using the cached assembly.         /// </summary>         public static ModuleBuilder Create()         {             string assemblyName = DynamicAssemblyCache.Get.GetName().Name;               ModuleBuilder moduleBuilder = DynamicAssemblyCache.Get.DefineDynamicModule                 (assemblyName, string.Format("{0}.dll", assemblyName));               DynamicModuleCache.Add(moduleBuilder);               return moduleBuilder;         }     } } As you can see, the module builder is created on the assembly that lives in the DynamicAssemblyCache, the module is given the assembly name and also a string representing the filename if the assembly is to be saved. It is then added to the DynamicModuleCache. DynamicModuleCache using System.Reflection.Emit; using Rapid.DynamicProxy.Exceptions; using Rapid.DynamicProxy.Resources.Exceptions; namespace Rapid.DynamicProxy.Module {     /// <summary>     /// Class for storing the module builder.     /// </summary>     internal static class DynamicModuleCache     {         #region Declarations           private static object syncRoot = new object();         internal static ModuleBuilder Cache = null;           #endregion           #region Add           /// <summary>         /// Adds a dynamic module builder to the cache.         /// </summary>         /// <param name="moduleBuilder">The module builder.</param>         public static void Add(ModuleBuilder moduleBuilder)         {             lock (syncRoot)             {                 Cache = moduleBuilder;             }         }           #endregion           #region Get           /// <summary>         /// Gets the cached module builder.         /// </summary>         /// <returns></returns>         public static ModuleBuilder Get         {             get             {                 lock (syncRoot)                 {                     if (Cache != null)                     {                         return Cache;                     }                 }                   throw new RapidDynamicProxyAssertionException(AssertionResources.NoModuleInCache);             }         }           #endregion     } }   The DynamicModuleCache is very similar to the assembly cache, it is simply a statically stored module with thread safe Add and Get methods.   The DynamicTypeCache To end off this post, I’m going to create the cache for storing the generated proxy classes. I’ve spent a fair amount of time thinking about the type of collection I should use to store the types and have finally decided that for the time being I’m going to use a generic dictionary. This may change when I can actually performance test the proxy generator but the time being I think it makes good sense in theory, mainly as it pretty much maintains it’s performance with varying numbers of items – almost constant (0)1. Plus I won’t ever need to loop through the items which is not the dictionaries strong point. Here’s the code as it currently stands: DynamicTypeCache using System; using System.Collections.Generic; using System.Security.Cryptography; using System.Text; namespace Rapid.DynamicProxy.Types {     /// <summary>     /// Cache for storing proxy types.     /// </summary>     internal static class DynamicTypeCache     {         #region Declarations           static object syncRoot = new object();         public static Dictionary<string, Type> Cache = new Dictionary<string, Type>();           #endregion           /// <summary>         /// Adds a proxy to the type cache.         /// </summary>         /// <param name="type">The type.</param>         /// <param name="proxy">The proxy.</param>         public static void AddProxyForType(Type type, Type proxy)         {             lock (syncRoot)             {                 Cache.Add(GetHashCode(type.AssemblyQualifiedName), proxy);             }         }           /// <summary>         /// Tries the type of the get proxy for.         /// </summary>         /// <param name="type">The type.</param>         /// <returns></returns>         public static Type TryGetProxyForType(Type type)         {             lock (syncRoot)             {                 Type proxyType;                 Cache.TryGetValue(GetHashCode(type.AssemblyQualifiedName), out proxyType);                 return proxyType;             }         }           #region Private Methods           private static string GetHashCode(string fullName)         {             SHA1CryptoServiceProvider provider = new SHA1CryptoServiceProvider();             Byte[] buffer = Encoding.UTF8.GetBytes(fullName);             Byte[] hash = provider.ComputeHash(buffer, 0, buffer.Length);             return Convert.ToBase64String(hash);         }           #endregion     } } As you can see, there are two public methods, one for adding to the cache and one for getting from the cache. Hopefully they should be clear enough, the Get is a TryGet as I do not want the dictionary to throw an exception if a proxy doesn’t exist within the cache. Other than that I’ve decided to create a key using the SHA1CryptoServiceProvider, this may change but my initial though is the SHA1 algorithm is pretty fast to put together using the provider and it is also very unlikely to have any hashing collisions. (there are some maths behind how unlikely this is – here’s the wiki if you’re interested http://en.wikipedia.org/wiki/SHA_hash_functions)   Anyway, that’s the end of part 1 – although I haven’t started any of the fun stuff (by fun I mean hairpulling, teeth grating Relfection.Emit style fun), I’ve got the basis of the DynamicProxy in place so all we have to worry about now is creating the types, interceptor classes, method invocation information classes and finally a really nice fluent interface that will abstract all of the hard-core craziness away and leave us with a lightning fast, easy to use AOP framework. Hope you find the series interesting. All of the source code can be viewed and/or downloaded at our codeplex site - http://rapidioc.codeplex.com/ Kind Regards, Sean.

    Read the article

  • Memory not being freed, causing giant memory leak

    - by Delan Azabani
    In my Unicode library for C++, the ustring class has operator= functions set for char* values and other ustring values. When doing the simple memory leak test: #include <cstdio> #include "ucpp" main() { ustring a; for(;;)a="MEMORY"; } the memory used by the program grows uncontrollably (characteristic of a program with a big memory leak) even though I've added free() calls to both of the functions. I am unsure why this is ineffective (am I missing free() calls in other places?) This is the current library code: #include <cstdlib> #include <cstring> class ustring { int * values; long len; public: long length() { return len; } ustring() { len = 0; values = (int *) malloc(0); } ustring(const ustring &input) { len = input.len; values = (int *) malloc(sizeof(int) * len); for (long i = 0; i < len; i++) values[i] = input.values[i]; } ustring operator=(ustring input) { ustring result(input); free(values); len = input.len; values = input.values; return * this; } ustring(const char * input) { values = (int *) malloc(0); long s = 0; // s = number of parsed chars int a, b, c, d, contNeed = 0, cont = 0; for (long i = 0; input[i]; i++) if (input[i] < 0x80) { // ASCII, direct copy (00-7f) values = (int *) realloc(values, sizeof(int) * ++s); values[s - 1] = input[i]; } else if (input[i] < 0xc0) { // this is a continuation (80-bf) if (cont == contNeed) { // no need for continuation, use U+fffd values = (int *) realloc(values, sizeof(int) * ++s); values[s - 1] = 0xfffd; } cont = cont + 1; values[s - 1] = values[s - 1] | ((input[i] & 0x3f) << ((contNeed - cont) * 6)); if (cont == contNeed) cont = contNeed = 0; } else if (input[i] < 0xc2) { // invalid byte, use U+fffd (c0-c1) values = (int *) realloc(values, sizeof(int) * ++s); values[s - 1] = 0xfffd; } else if (input[i] < 0xe0) { // start of 2-byte sequence (c2-df) contNeed = 1; values = (int *) realloc(values, sizeof(int) * ++s); values[s - 1] = (input[i] & 0x1f) << 6; } else if (input[i] < 0xf0) { // start of 3-byte sequence (e0-ef) contNeed = 2; values = (int *) realloc(values, sizeof(int) * ++s); values[s - 1] = (input[i] & 0x0f) << 12; } else if (input[i] < 0xf5) { // start of 4-byte sequence (f0-f4) contNeed = 3; values = (int *) realloc(values, sizeof(int) * ++s); values[s - 1] = (input[i] & 0x07) << 18; } else { // restricted or invalid (f5-ff) values = (int *) realloc(values, sizeof(int) * ++s); values[s - 1] = 0xfffd; } len = s; } ustring operator=(const char * input) { ustring result(input); free(values); len = result.len; values = result.values; return * this; } ustring operator+(ustring input) { ustring result; result.len = len + input.len; result.values = (int *) malloc(sizeof(int) * result.len); for (long i = 0; i < len; i++) result.values[i] = values[i]; for (long i = 0; i < input.len; i++) result.values[i + len] = input.values[i]; return result; } ustring operator[](long index) { ustring result; result.len = 1; result.values = (int *) malloc(sizeof(int)); result.values[0] = values[index]; return result; } operator char * () { return this -> encode(); } char * encode() { char * r = (char *) malloc(0); long s = 0; for (long i = 0; i < len; i++) { if (values[i] < 0x80) r = (char *) realloc(r, s + 1), r[s + 0] = char(values[i]), s += 1; else if (values[i] < 0x800) r = (char *) realloc(r, s + 2), r[s + 0] = char(values[i] >> 6 | 0x60), r[s + 1] = char(values[i] & 0x3f | 0x80), s += 2; else if (values[i] < 0x10000) r = (char *) realloc(r, s + 3), r[s + 0] = char(values[i] >> 12 | 0xe0), r[s + 1] = char(values[i] >> 6 & 0x3f | 0x80), r[s + 2] = char(values[i] & 0x3f | 0x80), s += 3; else r = (char *) realloc(r, s + 4), r[s + 0] = char(values[i] >> 18 | 0xf0), r[s + 1] = char(values[i] >> 12 & 0x3f | 0x80), r[s + 2] = char(values[i] >> 6 & 0x3f | 0x80), r[s + 3] = char(values[i] & 0x3f | 0x80), s += 4; } return r; } };

    Read the article

  • How to prevent latex memory overflow

    - by drasto
    I've got a latex macro that makes small pictures. In that picture I need to draw area. Borders of that area are quadratic bezier curves and that area is to be filled. I did not know how to do it so currently I'm "filling" the area by drawing a plenty of bezier curves inside it... This slows down typeseting and when a macro is used multiple times (so tex is drawing really a lot of quadratic bezier curves) it produces following error: ! TeX capacity exceeded, sorry [main memory size=3000000]. How can I prevent this error ? (by freeing memory after macro or such...) Or even better how do I fill the area determined by two quadratic bezier curves? Code that produces error: \usepackage{forloop} \usepackage{picture} \usepackage{eepic} ... \linethickness{\lineThickness\unitlength}% \forloop[\lineThickness]{cy}{\cymin}{\value{cy} < \cymax}{% \qbezier(\ax, \ay)(\cx, \value{cy})(\bx, \by)% }% Here are some example values for variables: \setlength{\unitlength}{0.01pt} \lineThickness=20 %cy is just a counter - inital value is not important \cymin=450 \cymax=900 %from following only the difference between \ax and \bx is important \ax=0 \ay=0 \bx=550 \by=0 Note: To reproduce the error this code have to execute approximately 150 times (could be more depending on your latex memory settings). Thanks a lot for any help

    Read the article

  • C++ Memory Leak, Can't find where

    - by Nicholas
    I'm using Visual Studio 2008, Developing an OpenGL window. I've created several classes for creating a skeleton, one for joints, one for skin, one for a Body(which is a holder for several joints and skin) and one for reading a skel/skin file. Within each of my classes, I'm using pointers for most of my data, most of which are declared using = new int[XX]. I have a destructor for each Class that deletes the pointers, using delete[XX]. Within my GLUT display function I have it declaring a body, opening the files and drawing them, then deleting the body at the end of the display. But there's still a memory leak somewhere in the program. As Time goes on, it's memory usage just keep increasing, at a consistent rate, which I'm interpreting as something that's not getting deleted. I'm not sure if it's something in the glut display function that's just not deleting the Body class, or something else. I've followed the steps for memory leak detection in Visual Studio 2008 and it doesn't report any leak, but I'm not 100% sure if it's working right for me. I'm not fluent in C++, so there maybe something I'm overlooking, can anyone see it?

    Read the article

  • Can this code cause a memory leak (Arduino)

    - by tbraun89
    I have a arduino project and I created this struct: struct Project { boolean status; String name; struct Project* nextProject; }; In my application I parse some data and create Project objects. To have them in a list there is a pointer to the nextProject in each Project object expect the last. This is the code where I add new projects: void RssParser::addProject(boolean tempProjectStatus, String tempData) { if (!startProject) { startProject = true; firstProject.status = tempProjectStatus; firstProject.name = tempData; firstProject.nextProject = NULL; ptrToLastProject = &firstProject; } else { ptrToLastProject->nextProject = new Project(); ptrToLastProject->nextProject->status = tempProjectStatus; ptrToLastProject->nextProject->name = tempData; ptrToLastProject->nextProject->nextProject = NULL; ptrToLastProject = ptrToLastProject->nextProject; } } firstProject is an private instance variable and defined in the header file like this: Project firstProject; So if there actually no project was added, I use firstProject, to add a new one, if firstProject is set I use the nextProject pointer. Also I have a reset() method that deletes the pointer to the projects: void RssParser::reset() { delete ptrToLastProject; delete firstProject.nextProject; startProject = false; } After each parsing run I call reset() the problem is that the memory used is not released. If I comment out the addProject method there are no issues with my memory. Someone can tell me what could cause the memory leak?

    Read the article

  • Android - Memory leak when dynamically building UI with image resource backgrounds

    - by Rich
    I have an Activity that I swear is leaking memory. The app I'm working on does a lot with images, so I've had to be pretty stingy with memory when working directly with Bitmaps. I added an Activity, and now if you use this new Activity it basically puts me over the edge with mem usage and I end up throwing the "Bitmap exceeds VM budget" exception. If you never launch this Activity, everything is smooth as it was previously. I started reading about memory leaks, and I think that I have a similar situation to what is described in the article in the Android docs. I'm dynamically creating a bunch of image views and adding a BackgroundDrawable from the resources and adding an OnClickListener as well. I imagine I have to do some cleanup when the Activity hits onPause in its life cycle, but I'd like to know specifically what is the correct way. Here is the code that should demonstrate the objects I'm working with... LinearLayout templateContainer; . . . ImageView imgTemplatePreview = (ImageView) item.findViewById(R.id.imgTemplatePreview); . . . imgTemplatePreview.setBackgroundDrawable(getResources().getDrawable(previewId)); imgTemplatePreview.setOnClickListener(imgClick); templateContainer.addView(item);

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >