Is the memory leak with TLF resolved ?
I just put 2 textfields in 2 differents frames. When I navigate into the frames . There is an increase of memory needed.
exemple
http://www.yapiodesign.com/files/TLF_Memory_Leak.zip
I got the same problem, and the only solution i found is to add frams to all the TlfTextfiled layers, and make the TlfTextfiled exist in all the frames of the movie clip.
For example, if my movieClip has 2 frames, and the TlfTextfield has 1 frame only, the movie clip will not be removed from the memory.
If we will add an empty frame to the TlfTextField layer, it will not solve it.
If we will add a frame with exatcly same object of the TlfTextField to the layer (without changing properties such as alpha or color), it will solve it.
I did'nt want the TlfTextField will be shown in all the frames, so i added as3 code in the specific frame for hiding the TlfTextField (myTlf.visible = flase).
It is a dirty solution, but a solution
Similar Messages
-
Memory Leak with GotoAndStop()
I am trying to track down a solution to a memory leak within an embedded video. If I embed a video on the timeline and then run gotoAndStop or gotoAndPlay to a specific frame every time the frame changes it takes in more memory until it crashes at about 1.7GB however if I run a straight play() on the same clip the memory usage remains constant. I have also tried System.gc() as it is an AIR App and have tried unloadAndStop() with the embeded video being loaded into a Loader and neither can reclaim any memory.
I am looking for a a way to resolve the memory leak or another way to be able to rapidly jump to specific frames of video as far as I know this is not possible with external flvs.
Thanks
Davevideo is much like a .gif file. if you start at frame 0 and jump to frame 30 it needs to redraw what it does nt have in frame 30 which means tellign it to start at frame 30 is the same as telling it to get all information from when it last changed which might be frame 27 to complete the frame of what should display on frame 30.
this is why its slow to play backwards. and best to play an flv forward.
what i would suggest if you do not need video persay, would be to use png sequences. but if your videos are long then i suppose it would be a greater advantage to keep it compressed.
what is the quality as well of the video and its size and your frame rate?
You mention that you are creating a 3d view, how is that? do you use more than 1 swf ?
I still think this does not sound like a play head issue, since the video is already compiled. -
Memory leaks with Third party classes
Hello all,
This is fairly known problem. But I guess, my problem gives a new dimention to the problem.
I have an application which is developed by me. This application ideally needed to use third party classes ( obviously no source code is supplied ). These third party classes provide extra functionality required.
The problem is, when I don't use third party classes in my application, every thing is fine. When I include third party classes, I am having memory leaks.
Then I tried to investigate memory leaks with Optimizeit tool. It is new to me. As of now, I understood, we can identify where the memory leaks are occuring.
finally the problem is, in order to solve this, I need some patches in the code. But I don't have source code for those classes. How to solve this problem?
For example,
I use a third party classes in my code like this,
ThirdPartyMemoryLeakClass obj = new ThirdPartyMemoryLeakClass();
This 'obj' is made static, as it takes lot of time to create this object. Obviously this object contains several references to other objects, which I can't control.
In the process of reusing this object, I am getting memory leaks.
Any ideas regarding, how one has to deal this type of situations? What are the issues involved with this case? Are there any similar problems, which have been solved? are most welcome.
many thanks for your time.
MadhavDecompile it using jad. Find leak.Yes, I too got the idea and tried to decompile those classes and recompile. I had some problems while recompiling. Is this is the only way to get rid of this problem?
I was refering to powersoft.datawindow.DataStore class. Does any body here has worked on these?
Can you suggest me how to find the memory leak causes? if you were needed to find out memory leak causes, what would be your approach?
Madhav -
[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!
-
Memory leak with CGImageSourceCreateThumbnailAtIndex
After creating a thumbnail with CGImageSourceCreateThumbnailAtIndex, CGImageRelease doesn't seem to work!? I am rendering full-size thumbnails of PDF pages, and this just leaks memory:
void memLeakTest(CFStringRef sourcePath) {
printf("Running memLeakTest...
CFURLRef url = CFURLCreateWithString(NULL, sourcePath, NULL);
CGImageSourceRef imageSource = CGImageSourceCreateWithURL(url, NULL);
CFStringRef keys[3];
CFTypeRef values[3];
int n=0;
keys[n] = kCGImageSourceCreateThumbnailFromImageAlways;
values[n++] = kCFBooleanTrue; //If I set this to false, there is no leak, but I need the thumbnails
keys[n] = kCGImageSourceCreateThumbnailWithTransform;
values[n++] = kCFBooleanTrue;
keys[n] = kCGImageSourceShouldCache;
values[n++] = kCFBooleanFalse;
CFDictionaryRef options;
options = CFDictionaryCreate(kCFAllocatorDefault, (const void **)keys, values, n, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CGImageRef image = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, options);
CFRelease( imageSource );
CGImageRelease( image ); //Doesn't seem to have any effect. Memory continues to balloon.
CFRelease( url );
int main (int argc, const char * argv[]) {
CFStringRef pathUrl = CFSTR("file:/path/to/a/big.pdf");
while( true ) {
memLeakTest( pathUrl );
if( n < maxPages ) sleep(5); //Wait 5 seconds
return 0;I was able to fix the memory leak using the following code:
void memLeakTest(CFStringRef sourcePath) {
printf("Running memLeakTest...
CFURLRef url = CFURLCreateWithString(NULL, sourcePath, NULL);
CFStringRef keys[10];
CFTypeRef values[10];
int n=0;
//keys[n] = kCGImageSourceCreateThumbnailFromImageIfAbsent;
//values[n++] = kCFBooleanTrue;
keys[n] = kCGImageSourceCreateThumbnailFromImageAlways;
values[n++] = kCFBooleanTrue;
keys[n] = kCGImageSourceCreateThumbnailWithTransform;
values[n++] = kCFBooleanTrue;
keys[n] = kCGImageSourceShouldCache;
values[n++] = kCFBooleanFalse;
CFDictionaryRef options;
options = CFDictionaryCreate(kCFAllocatorDefault, (const void **)keys, values, n,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
//CGImageSourceRef imageSource = CGImageSourceCreateWithURL(url, options);
NSImage* imageFile = [[NSImage alloc] initByReferencingURL: (NSURL *)url];
NSData * data = [imageFile TIFFRepresentation];
CGImageSourceRef imageSource = CGImageSourceCreateWithData((CFDataRef)data, options);
CGImageRef image = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, options);
CFRelease( image );
CFRelease( imageSource );
[imageFile release];
CFRelease( options );
CFRelease( url );
There are a number of different graphics APIs you could use. I'm no expert in any of them, so I used the simple ones. The above code requires both Objective-C and an autorelease pool, but I'm sure you could use different functions to remove those requirements. -
Memory Leak with 4.5.1/Java/Solaris
Hi,
We are currently running a Java Application using RMI/Weblogic 4.5.1/Solaris 5.7/Java 1.22.
Behavior that has been observered during the day is that memory usage reaches a stage in which it begins increasing and GC doesn't recover any memory, until the heap reaches an extremly large size, then recovers a significant amount of memory.
We have even seen the java process grab more memory than specified in the -Xmx parameter and experience a java.lang.OutOfMemory error.
I have seen postings that describe similar issues in this newsgroup, but none that define a solution.
This problem is intermittent, and our application can run an entire day without experiencing this memory leak. On the other hand there are days when the memory leak occurrs even when the system is idle overnight.
Please let me know any information you have gathered on this subject.
Regards,
Mark Evanstry increasing your virtual memory on your NT system...
"Parasher K. Joshi" <[email protected]> wrote:
>
Hi,
I observed the same confusing stuff in my tests. But I run weblogic 4.5.1 on Windows NT with JDK 1.2.2-w
Usually, I would get a "Low virtual memory" message from windows
and if I click ok & shuffle thourgh my windows I would be ok.
But since last 2 days, I would keep the server running overnight.
When I return in morning,
I would find a "Low virtual memory" message and
on clicking OK. I would find another message tell me that java.exe (which was running weblogic) crashed!!
Now today I tried to watch the memory usage in Task Manager. And I found the most wierd thing.
I saw that even when the system was doing virtually nothing,
except print a string at intervals, the memory usage would go
up steadyly.
Even doing a forced finalization and gc did not seem to stop it.
BUT, BY CHANCE I HAPPEN TO MINIMISE AND MAXIMISE THE WEBLOGIC
CONSOLE OUTPUT WINDOW.
WHAT I SAW IN THE TASK MANAGER AMAZED ME!
THE MEMORY USAGE IN TASK MANAGER HAD GONE DOWN TO 24XXKB, WHILE
IT WAS ABOUT 20000K OR EVEN MORE.
This seems to support the fact that during my test, I would
get the "low virtual memory" message and if OKed it and shuffled
though application windows (maybe minimise, maximise the weblogic
console output window in process), I would be able to complete
my application. But when the message appears during night runs,
nothing is done and by morning, when I reach to work,
I would see that weblogic had crashed!!
You may try that and see if it helps you.
Parasher
Mark Evans <[email protected]> wrote:
Hi,
We are currently running a Java Application using RMI/Weblogic 4.5.1/Solaris 5.7/Java 1.22.
Behavior that has been observered during the day is that memory usage reaches a stage in which it begins increasing and GC doesn't recover any memory, until the heap reaches an extremly large size, then recovers a significant amount of memory.
We have even seen the java process grab more memory than specified in the -Xmx parameter and experience a java.lang.OutOfMemory error.
I have seen postings that describe similar issues in this newsgroup, but none that define a solution.
This problem is intermittent, and our application can run an entire day without experiencing this memory leak. On the other hand there are days when the memory leak occurrs even when the system is idle overnight.
Please let me know any information you have gathered on this subject.
Regards,
Mark Evans -
Memory leak with fieldpoint and labview
I have an application which is showing an issue of a memory leak. The application does several things, but the part that seems to be causing the trouble is related to use of Fieldpoint VIs. The application reads individual AI channels on a Fieldpoint AI-110 (10 channels, where the set of channels is measured once per second) I have attached the code related to this. The memory leak is quite large (~1.5GB in 24 hours of operation).
I am using LabView 7.1, and Fieldpoint 4.1. The parent application which uses the attached code is a stand-alone application. The operating system is Windows 2000. Fieldpoint communication occurs over a RS-232 link.
Thanks in advance,
Andy
Attachments:
FPAI100_meas_voltage.vi 62 KBHi Andy,
I did not see anything fundamentally wrong with what you wrote, but there were
a few things that I think could be used to be changed. However, there
were a few things that I did modify that might make a bit of a
difference. In your application you were using sequences and a bunch of
local variables. Since LabVIEW is based upon data flow, you can control
the sequence of execution by making data dependencies and simply wiring one
thing to the next. By simply using LabVIEW the way it is meant to run I
was able to completely remove the sequence structure and also eliminate the use
of all of the local variables, all while having the exact same execution order.
It could be that the local variables were causing the memory leak that you
noticed, but I really doubt they could be the cause of such a large leak.
I really think there is probably something else going on in the application
because from what I saw from this bit of code there really is no way that it
would have such large problems. Users use the FP commands daily without
any problems, so most likely these are not the root of the problem.
Go ahead and try the modified code and see if you can implement similar local
and global variable reducing techniques throughout your application.
Hopefully that will help reduce some of the memory leaks you are seeing.
Typically the largest cause of an apparent memory leak really occurs from
building an array within a loop, so make sure you don't have any situations
where that occurs in your code either.
Regards,
Otis
Training and Certification
Product Support Engineer
National Instruments
Attachments:
724727-FPAI100_meas_voltage.vi 56 KB -
Memory leak with File Write.vi
Hi All,
I am trying to save a big data cluster, which includes images, into a data log file. The vis I use are: New File.vi, Write File.vi, Close File.vi.
The problem is Write File.vi has memory leak when the data cluster includes images .
Anyone sees similar case? Any solution?
Thanks.
AiqiuAiqiu,
I am glad you found out about flattening your image to a string. I was about to post and say that you probably didn't want to save the IMAQ image reference to a file, because after you closed the image in memory, there wouldn't be anything for the IMAQ image reference to point to. You are correct to flatten the image to a string. Below is a link to a document which discusses doing this to communicate over datasocket, but the processes of flattening the image to a string is the same regardless of whether or not you are sending the image across a datasocket connection or saving to a file.
Transfering Images with DataSocket
As for the memory leak. I am pretty sure that if you passed all of the IMAQ Image references created in the "Image Init Buffer.vi" subVI and then closed each reference individually, that the memory leak would probably go away.
Lorne Hengst
Application Engineer
National Instruments -
Memory Leak with cloneModelFromCastMember()?
Hello Experts!
I have been experiencing an apparent memory leak within
Director 11 when
using cloneModelFromCastMember().
I was making the assumption that calling resetWorld() on a
w3D member
onBeginSprite() would garbage collect any models previously
cloned into that
when I previously ran the movie.
However, if I repeatedly start and stop the movie Director
Gobbles roughly
10Mb more memory each time. The memory usage does not reduce
upon calling
resetWorld()
A good way to replicate this is to use
cloneModelFromCastMember() on a
largeish model in a repeat with i = 1 to 50 loop on the on
beginSprite
handler.
Start and stop the movie over and over to see Director's
memory usage hike
up.
Anybody have any advice why this is happening? Do I need to
explicitly
delete all models cloned into a member on stopMovie????
Cheers
Richard SmithHi Zzzorro,
Thanks for the advice!
Why does cloning from external w3D members help? Does it
avoid the memory
leak? It never used to happen on Director 8.5 so it has to be
a new Version
10 / 11 bug right?
I need to import several weightmapped boned characters into a
3D member, and
due to export issues each character has to have it's own w3D
file.
So I have to perform cloning at runtime to build the world. I
also need to
clone these characters based on the level, so I can't use
just one single 3D
member for both these reasons.
Thanks for any further ideas.
Richard Smith
"zzzorro" <[email protected]> wrote in
message
news:gd4sn2$2l8$[email protected]..
> as a rule of thumb:
> whenever possible avoid cloneModelFromCastMember in the
first place.
> It is highly unrecommended and the intel engineers
always recommended to
> use
> loadFile() with an external w3d file, which is much
better than having the
> w3d
> file in the castlib and using cmfcm.
> each cmfm rebuilds the whole scene and takes a lot of
time the bigger the
> scene is.
> apart from glitches like leaks, which you found right
now and other
> things.
>
> I work very much with sw3d and I barely have more than
one shockwave3d
> member
> in any of my movies. in very rare cases I use 2 sw3d
members. Other than
> that I
> use one member where I build and load everything into
from external w3d
> files
> with loadFile(), which is much more appropriate. the
only downside is that
> I
> can't change the model name, but there are ways to deal
with it.
> -
Memory leak with Visa Close in loop
I read the other posts about the memory leak problems with Visa Close, but eliminating the Visa Close from VI causes problems with read & write (it seems to go out of sync). Any suggestions? Example attached.
Attachments:
MKS_651C_Serial_Communication.vi 144 KBSolved the problem. I had to change the bit count and adjust sort. Removing the Visa Close did eliminate the memory leak.
-
Memory leak with callback function
Hi,
I am fairly new to LabWindows and the ninetv library, i have mostly been working with LabVIEW.
I am trying to create a basic (no GUI) c++ client that sets up subscriptions to several network variables publishing DAQ data from a PXI.
The data for each variable is sent in a cluster and contains various datatypes along with a large int16 2D array for the data acquired(average array size is 100k in total, and the average time between data sent is 10ms). I have on average 10 of these DAQ variables.
I am passing the same callback function as an arguement to all of these subscriptions(CNVCreateSubcription).
It reads all the correct data, but i have one problem which is that i am experiencing a memory leak in the callback function that i pass to the CNVCreateSubscription.
I have reduced the code one by one line and found the function that actually causes the memory leak, which is a CNVGetStructFields(). At this point in the program the data has still not been passed to the clients variables.
This is a simplified version of the callback function, where i just unpack the cluster and get the data (only showing from one field in the cluster in the example, also not showing the decleration).
The function is passed into to the subscribe function, like so:
static void CNVCALLBACK SubscriberCallback(void * handle, CNVData data, void * callbackData);
CNVCreateSubscriber (url.c_str(), SubscriberCallback, NULL, 0, CNVWaitForever, 0 , &subscriber);
static void CNVCALLBACK SubscriberCallback(void * handle, CNVData data, void * callbackData)
int16_t daqValue[100000];
long unsigned int nDims;
long unsigned int daqDims[2];
CNVData fields[1];
CNVDataType type;
unsigned short int numFields;
CNVGetDataType(data, &type, &nDims);
CNVGetNumberOfStructFields (data, &numFields);
CNVGetStructFields (data, fields, numFields); // <-------HERE IS THE PROBLEM, i can comment out the code after this point and it still causes a memory leak.
CNVGetDataType(fields[0], &type, &nDims);
CNVGetArrayDataDimensions(fields[0], nDims, acqDims);
CNVGetArrayDataValue(fields[0], type, daqValue, daqDims[0]*daqDims[1]);
CNVDisposeData(data);
At the average settings i use all my systems memory (4GB) within one hour.
My question is, have any else experienced this and what could the problem/solution to this be?
Thanks.
Solved!
Go to Solution.Of course.....if it is something i hate more than mistakes, it is obvious mistakes.
Thank you for pointing it out, now everything works -
Memory leak with jsp and beans
The application we have created has one particular page that is designed to stay up in the browser and refresh with new information from database queries once every 60 seconds. Running with Tomcat3.2.1 and IE5.5
The problem is that the memory usage of java.exe continues to grow until the machine crashes from out of memory. It does take more than 24 hours to crash.
Things I have tried to do to track down the problem or eliminate the problem.
- I have explicitly set the scope of the beans to "page"
- I have watched the DatabaseAccess.class (the beans are all extended from this class) and put in code to watch how many instantiations of the class are made and subsequently garbage collected. This appears to be where the memory leak may reside - hundreds of instantiations from some other source than the page I am displaying.
- the top frame makes database queries for security and display of a menu system dependant upon security clearance. It does not set any time for refresh (refresh == 0). Nor does it explicitly set a scope for the beans.
- I have run a different jsp engine to see if this was directly related to Tomcat - same problem with resin2.0.0
The main jsp page that is in the bottom section of the page has the following code:
** only the relevant lines are included here
<%@ include file="../../common.jsp" %>
<%
refresh=60;
%>
<head>
<%@ include file="../../meta_head.jsp" %>
</head>
<body bgcolor="#FFFFFF" text="#003399" link="#660099" vlink="#990099" alink="#006666" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%@ include file="../../access.jsp" %>
<%@ include file="../../page_title.jsp" %>
<jsp:useBean id="Line" class="jsp.Line" scope="page" />
<jsp:useBean id="Machine" class="jsp.Machine" scope="page"/>
<jsp:useBean id="Alarm_log" class="jsp.Alarm_log" scope="page"/>
contents of meta_head.jsp
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV= "expires" content = "0">
<META HTTP-EQUIV="Pragma" CONTENT="no_cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache" forua="true">
<META NAME="robots" content="NOINDEX,NOFOLLOW">
<%
if (refresh > 0)
%>
<meta http-equiv="Refresh" content="<%= refresh %>">
<%
If anyone has some suggestions on how to trap this memory leak, it would be terrific. Or, some other things to try to stop the instantiation of the DatabaseAccess object (perhaps setting the scope of the beans in the header to "session" or "application"?).
Thanks in advance.
Robertajsp:useBean tags scope declaration :
page = Create a new instance on each load.
session = Load instance from the session, if not there, create one
application = Load instance from the ServletContext, if not there, create one.
Not sure how you are populating the data variables, but make sure you are closing all ResultSet, (Prepared)Statement, and Connection objects. -
Memory leak with 1.6.0_07 in applet using Swing
Java Plug-in 1.6.0_07
Using JRE version 1.6.0_07 Java HotSpot(TM) Client VM
Windows XP - SP2
I have a commercial application that has developed a memory leak with the introduction of the latest plugin. The applets chew up memory and eventually freeze. They did not before. Using jvisualm I see a build up of native arrays, primarily int[][] and char[]. I'm still investigating. Anyone have a similar experience?
The Applet uses a swing interface, uses buffered images and swing timers, and regularly performs http connections to the server which result in actions via the SwingUtil.invokeLater() method.I am Using Internet Explorer Browser Version 6.0.Huge security hole.
Its not throwing Error / Exception Wrap a try/catch at the highest level possible.
Catch 'Throwable'. And log/display it somewhere. -
Memory leak with UI automation
Hi,
I noticed there is memory leak with UI automation in my window 8.1.
I noticed there is solution for window 8
http://support.microsoft.com/kb/2885482
Is there any solution for window 8.1?
I really appreciate for any help.Hi,
I'm sorry for didn't hear anything about this issue. I'll try to connect the writer of this KB, hope we can find some suggestion. If there is any progress about this problem, I would come back.
Roger Lu
TechNet Community Support -
It seems there is a memory leak with JPopupMenu. The following program demonstrates this leak. If you run the program, click on show form, and then close the form, the used memory will be GCd appropriately. If you click on show form, then right click on the table to show the popup (even if you dont do anything else with the popup) then close the form, it never GCs the form. I've tried all kinds of crazy things, but I cant seem to find what is keeping the memory from being GCd.
Peter
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.beans.PropertyChangeListener;
import java.text.DecimalFormat;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Vector;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;
@SuppressWarnings("serial")
public class TriState extends JPanel {
private static final long K = 1024;
private static final long M = K * K;
private static final long G = M * K;
private static final long T = G * K;
protected static int ctr = 1;
private JButton btnShow = new JButton("Show Form");
private JLabel lblMem = new JLabel();
private static final DecimalFormat df = new DecimalFormat("#,##0.#");
protected Timer updateTimer = new Timer();
public TriState() {
this.setLayout(new GridLayout());
add(btnShow);
add(lblMem);
updateTimer.scheduleAtFixedRate(new UpdateTimerTask(), 1000, 1000);
btnShow.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FrmReferrals fr = new FrmReferrals();
fr.setVisible(true);
class UpdateTimerTask extends TimerTask {
public void run() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
dumpMemoryUsage();
protected void dumpMemoryUsage() {
System.gc();
Long t = Runtime.getRuntime().totalMemory();
long f = Runtime.getRuntime().freeMemory();
String st = convertToStringRepresentation(t);
String sf = convertToStringRepresentation(f);
String su = convertToStringRepresentation(t - f);
System.out.println("Total:" + st + "(" + t + ") Free:" + sf + "(" + f + ") Used:" + su + "(" + (t - f) + ")");
lblMem.setText(su + "/" + st);
public static String convertToStringRepresentation(final long value) {
final long[] dividers = new long[]{T, G, M, K, 1};
final String[] units = new String[]{"TB", "GB", "MB", "KB", "B"};
if (value < 1)
throw new IllegalArgumentException("Invalid file size: " + value);
String result = null;
for (int i = 0; i < dividers.length; i++) {
final long divider = dividers;
if (value >= divider) {
final double dr = divider > 1 ? (double) value / (double) divider : (double) value;
result = df.format(dr) + units[i];
break;
return result;
private static void createAndShowGUI() {
JFrame frame = new JFrame("SimpleTableDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create and set up the content pane.
TriState newContentPane = new TriState();
newContentPane.setOpaque(true); // content panes must be opaque
frame.setContentPane(newContentPane);
// Display the window.
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
protected class PopupMenu extends JPopupMenu {
public PopupMenu() {
JRadioButtonMenuItem item1 = new JRadioButtonMenuItem(new AbstractAction("Insert Item") {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println(e.getActionCommand());
item1.setActionCommand("Insert");
add(item1);
JRadioButtonMenuItem item2 = new JRadioButtonMenuItem(new AbstractAction("Delete Item") {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println(e.getActionCommand());
item2.setActionCommand("Delete");
add(item2);
public class FrmReferrals extends JFrame {
public FrmReferrals() {
super();
init();
protected void init() {
jbInit();
protected void closeIt() {
uninit();
// variables here
protected Dimension dimPreferred = new Dimension(1270, 995);
protected JTabbedPane tabbedPane = new JTabbedPane();
protected JTable tblReferrals = null;
protected PopupMenu popMenu = new PopupMenu();
protected void jbInit() {
setPreferredSize(dimPreferred);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setTitle("Referrals");
JPanel pnl = new JPanel();
pnl.setOpaque(false);
pnl.setLayout(new BorderLayout());
pnl.add(tabbedPane, BorderLayout.CENTER);
// put it all in the frame
add(pnl);
pack();
setLocationRelativeTo(null);
// init the table and model
ReferralsTableModel ctm = new ReferralsTableModel(buildDummyVector());
tblReferrals = new JTable(ctm);
tblReferrals.setComponentPopupMenu(popMenu);
tblReferrals.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
tabbedPane.add(new JScrollPane(tblReferrals, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED));
addWindowListener(new WindowListener() {
@Override
public void windowActivated(WindowEvent e) {}
@Override
public void windowClosed(WindowEvent e) {}
@Override
public void windowClosing(WindowEvent e) {
closeIt();
@Override
public void windowDeactivated(WindowEvent e) {}
@Override
public void windowDeiconified(WindowEvent e) {}
@Override
public void windowIconified(WindowEvent e) {}
@Override
public void windowOpened(WindowEvent e) {}
protected Vector<DBO_Referrals> buildDummyVector() {
Vector<DBO_Referrals> vr = new Vector<DBO_Referrals>();
for (int x = 0; x < 5000; x++) {
DBO_Referrals r = new DBO_Referrals(x+(5000*ctr));
vr.add(r);
return vr;
protected void uninit() {
tblReferrals.setComponentPopupMenu(null);
for (Component c : popMenu.getComponents()) {
PropertyChangeListener[] pl = c.getPropertyChangeListeners();
for (PropertyChangeListener l : pl)
c.removePropertyChangeListener(l);
if (c instanceof JMenuItem) {
ActionListener [] al = ((JMenuItem)c).getActionListeners();
for (ActionListener l : al) {
((JMenuItem)c).removeActionListener(l);
popMenu = null;
protected class DBO_Referrals {
protected long id;
protected String Employee;
protected String Rep;
protected String Asst;
protected String Client;
protected String Dates;
protected String Status;
protected String Home;
public DBO_Referrals(long id) {
this.id = id;
Employee = "Employee" + id;
Rep = "Rep" + id;
Asst = "Asst" + id;
Client = "Client" + id;
Dates = "Dates" + id;
Status = "Status" + id;
Home = "Home" + id;
public long getId() {
return id;
public String getEmployee() {
return Employee;
public String getRep() {
return Rep;
public String getAsst() {
return Asst;
public String getClient() {
return Client;
public String getDates() {
return Dates;
public String getStatus() {
return Status;
public String getHome() {
return Home;
public class ReferralsTableModel extends AbstractTableModel {
protected Vector<DBO_Referrals> data = new Vector<DBO_Referrals>();
protected String[] sColumns = {"id", "Employee", "Rep", "Assistant", "Client", "Date", "Status", "Home", "R"};
public ReferralsTableModel() {
super();
public ReferralsTableModel(Vector<DBO_Referrals> data) {
this();
this.data = data;
@SuppressWarnings("unchecked")
@Override
public Class getColumnClass(int col) {
switch (col) {
case 0 :
return Long.class;
default :
return String.class;
@Override
public int getColumnCount() {
return sColumns.length;
@Override
public int getRowCount() {
return data.size();
@Override
public Object getValueAt(int row, int col) {
if (row > data.size())
return null;
DBO_Referrals a = data.get(row);
switch (col) {
case 0 :
return a.getId();
case 1 :
return a.getEmployee();
case 2 :
return a.getRep();
case 3 :
return a.getAsst();
case 4 :
return a.getClient();
case 5 :
return a.getDates();
case 6 :
return a.getStatus();
case 7 :
return a.getHome();
case 8 :
return "+";
default :
return null;BTW instead of continually printing out the memory use a profiler (jvisualvm in the jdk/bin directory -> heapdump -> search on your class -> view in instances -> find nearest GC root).
Looks like BasicPopupMenuUI doesn't remove a reference to the JRootPane immediately. As far as I can see it will be removed when another menu shows.
As a hackish workaround you can try this in you FrmReferrals#uninit():
for(ChangeListener listener : MenuSelectionManager.defaultManager().getChangeListeners()) {
if (listener.getClass().getName().contains("MenuKeyboardHelper")) {
try {
Field field = listener.getClass().getDeclaredField("menuInputMap");
field.setAccessible(true);
field.set(listener, null);
} catch (Exception e) {
// ignored
break;
}Funnily enough though it isn't there when I reduce your code to a SSCCE:
import java.awt.*;
import javax.swing.*;
public class TestBasicPopupMenuUILeak extends JFrame {
public TestBasicPopupMenuUILeak() {
super("Not collected right away");
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame("Test");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.getContentPane().add(
new JButton(new AbstractAction("Show frame") {
@Override
public void actionPerformed(ActionEvent e) {
EventQueue.invokeLater(new Runnable() {
public void run() {
JLabel label = new JLabel(
"Right click to show popup, then close this frame."
+ "The frame with not be GCed until another (popup) menu is shown.");
JPopupMenu popup = new JPopupMenu(
"Popup");
popup.add("Item");
label.setComponentPopupMenu(popup);
// named differently so you can find it
// easily in your favorite profiler
JFrame frame = new TestBasicPopupMenuUILeak();
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.getContentPane().add(label);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
Maybe you are looking for
-
HPlip: "Unable to communicate with the device" error
Hello Arch Community, I've been a user of Arch for a while and most of it just worked out of the box. However, I had my HP 6300 working through a direct connection. But a couple of days ago it just broke. I've tried everything I could think of to mak
-
Help! I am trying to upload movies from my iTunes to my iPhone and it will only upload a select few. Why?
-
Latency in upload of content search web part
Hi, We have a customer who use sharepoint which is adjasted to mobile, and it seems that when user access in vpn or mobile - it takes too much time till web parts are loaded. These are Content Search web parts that display pictures. Is there any set
-
How can I creat a new folder?
How can I creat a new folder?
-
After automatic renaming dhcpcd on enp4s0 fails to load
Hello, I installed arch and had this from the very beginning (and reinstalled it and had the same issue): hwdb.bin does not exist, please run udevadm hwdb --update Everything worked, but after 4 days this error occured: [ TIME ] Timed out waiting for