I have realized that my use of malloc that has been working fine with sizes up to ~1.5mb always fails when going over that size. It has been rare that I ever actually need more than that but it creates a problem.
I am no expert on how windows sets up memory for programs and only have a rough idea about it. I have tried creating a heap and allocating memory from that, but that fails too.
eg
unsigned long sizeOfDataBlock;
HANDLE he=HeapCreate(NULL,sizeOfDataBlock+1024,NULL);
dose not return NULL
but
char*returnBlock=(char*)HeapAlloc(he,NULL,sizeOfDataBlock);
dose return NULL.
Can someone give some pointers on how to get hold of more memory to work with please.
You could consider using VirtualAlloc and VirtualFree instead I think. That's advisable for large allocations of contiguous memory.
V
I substituted them but it did not help. I also realized that the problem was not a size of 1.5mb but more like between 7-9mb. I was holding the same data in multiple seperate places so I re-aranged my code to use only 1 copy but the cost was more entangled code. The thing I still do not get is why the memory manager can show more than 20mb of free storage and 20mb free program memory but can't give me th 9 I want. On the first calls to malloc I can see the in use value rize by what I expected but before the last rize my error code tells me it failed.
Its probably bad practice to hog that much memory on a device any way.
I have found something else very interesting.
I made a small program to just allocate blocks and then give time to see the memory manager to confirm the effect. I can allocate as much memory in one call to malloc as the device can provide. Even if the program memory is less than what I request it adjusts with storage to allow huge allocations. I can still make it fail but only after about 24mb.
Why then can the same not be done from within my other program. Could it be that having more than one thread limits the amount of memory each thread can get. I would really like to understand this because memory allocations are at the hart of just about everything.
<<edit>>
I added 4 threads to my test app and tried again. The result was that I could allocate even more from the main thread, 4mb more. Why????
I have a problem.
I make use of malloc or new in many places to store data in. I normally have no problem but there seems to be a limit on how much I can use it. I always free/delete as soon as I no longer need the memory and always check for 0 returned. I have mechanisms in place in case of 0 but when malloc actually fails it dose not return. Malloc just never returns and hence crashes my program. What could be the cause of this?
+The actual memory I am requesting is ~2-20k, the available memory is 20-30mb.
I am considering creating a heap, using it to allocate blocks from and destroying it to clean the memory. This is a time consuming change, dose anybody have some experience with this problem?
The annoying part is that the code works 100% on old devices and fails on new ones. I never thought i would be rewriting this code.
The heap way did work. The problem is that on ce, to create a heap you have to set aside the size first. Also there are still some problems I am having with memory that I pass out of a dll and then pass back in to free. Still its better than crashing! I may solve the freeing of individual pointers by just replacing it with a periodic call to HeapDestroy to clear them all out, something else that can't be done with malloc.
I've tried clearing the dalvikvm cache but that didn't solve my 'problem'.
My concern was when opening aLogcat, it puts
"D/dalvikvm( 1451): GC_EXPLICIT freed 655 objects / 23384 bytes in 40ms"
over and over
usually the 1451 stays the same, randomly it will be another number, not often.
It logs this message once every second, this seems unnecessary, but might not be...
Can anyone offer some suggestions as to what dalvikvm is doing and if it is necessary to stop it?
I've seen other people post their log files but they do not have this dalvikvm process going on.
I do have a modified prop.build file installed, i've attached it if anyone thinks it's worth looking at.
derekm_ said:
I've tried clearing the dalvikvm cache but that didn't solve my 'problem'.
My concern was when opening aLogcat, it puts
"D/dalvikvm( 1451): GC_EXPLICIT freed 655 objects / 23384 bytes in 40ms"
over and over
usually the 1451 stays the same, randomly it will be another number, not often.
It logs this message once every second, this seems unnecessary, but might not be...
Can anyone offer some suggestions as to what dalvikvm is doing and if it is necessary to stop it?
I've seen other people post their log files but they do not have this dalvikvm process going on.
I do have a modified prop.build file installed, i've attached it if anyone thinks it's worth looking at.
Click to expand...
Click to collapse
That has to do with the 'level' or verbosity of the log your seeing. Those are low-level events. I forget how to do this in alogcat, but you just need to change the verbosity level and it won't show them
I'm one of the "lucky bastards" who cancelled BBY preorder, ordered from TD and got tablet 2 days ago. When I got the tablet, I installed few applications, 2 different launchers and put an SD card from an old Note 10.1 (500 books/documents, 2Gb music, 2Gb video files). Tablet was very slow, sometimes taking 2-3 seconds to open app drawer. When in S Note, I was often getting "unfortunately IndexService has stopped". I used a task manager, checked this service, it was using most of CPU all the time. I found a thread in Note 3 forum about this service using most of battery. This seems to be a service for new S Finder. On my tablet it was scanning files all the time. I may have a corrupted file or something that it doesn't like. I moved all files from SD, service stopped crashing, lag is gone. I have started moving files back one folder at a time, hoping to find out the bad file.
If you see lag on yours, see if you have this IndexService running all the time.
Have the exact same problem on my note 3 atm. What a pain in the ass to deal with.
Sent from my SM-N900T using Tapatalk 4
I will keep that in mind as of right now I have not had the index service issue happen with mine. Where can I see if the index service is constantly running?
...Sent from my Tablet...Please excuse any typo's...
Well done, trouble shooting though
Rickgsx said:
I will keep that in mind as of right now I have not had the index service issue happen with mine. Where can I see if the index service is constantly running?
...Sent from my Tablet...Please excuse any typo's...
Click to expand...
Click to collapse
I'm using "SystemPanel App / Task Manager" from market, had bought it during 2.2 days, hadn't installed on any of my JB devices. I remembered about that, installed, turned on monitoring and kept an eye on top processes. I'm not saying this is the only reason for lag, but for me there was a big difference after I cleaned the SD card.
I had the same problem but I just removed my SD card let it index then when stabilized in inserted back works good so far secondly u should disable air command
try and see how it work it works very good with me after ur phone get stabilized re activate ur air command
For me the culprit was a corrupted pdf file. My Note3 was fine after I deleted that file.
Moreover I found that the indexservice process is taking more cpu and time when I have more number of pdf files i my memory card.
So, right now either you can put less number of pdf files on your device to avoid the lag or just wait till the indexing completes.
After the indexing completes, the device works as wonderfully as it was working before inserting my memory card.
Hope I helped...Cheer!!!
I also got same message.
Pls help me, I am layman as to xda forum, pls tell how get rid of this "Unfortunately, IndexService has stopped." I get this message every time I start my device.
As per recent post of this thread I understood that some corrupt files cause this problem, but how to find that particular file?
I have copy & pasted 12-14gb pdf,vdo,zip,doc,xls,ppt all my academic files into internal memory of 32gb.
Please help me out here.
Suggest some windows based software to scan corrupt files.
Some body please suggest solution to this indexing problem...
tspatil001 said:
Some body please suggest solution to this indexing problem...
Click to expand...
Click to collapse
Use "trials and errors" method, remove your files, make sure search is running fine (which means it's not running all the time nor crashing), then start adding few files/folders at a time. Time consuming of course, but I don't know any other way of doing it. I don't know if this process creates a log file with scan information, that file would be useful.
tspatil001 said:
Pls help me, I am layman as to xda forum, pls tell how get rid of this "Unfortunately, IndexService has stopped." I get this message every time I start my device.
As per recent post of this thread I understood that some corrupt files cause this problem, but how to find that particular file?
I have copy & pasted 12-14gb pdf,vdo,zip,doc,xls,ppt all my academic files into internal memory of 32gb.
Please help me out here.
Suggest some windows based software to scan corrupt files.
Click to expand...
Click to collapse
Try
Going to settings
General
Storage
Clear cached files
If that doesnt work, assuming you are rooted clear cache and data files. TI, Rom Toolbox, others can do this. Or if you have custom recovery boot to recovery and clear in recovery.
Woody
Sent from my SM-P600 using Tapatalk
woodsonmh said:
Try
Going to settings
General
Storage
Clear cached files
If that doesnt work, assuming you are rooted clear cache and data files. TI, Rom Toolbox, others can do this. Or if you have custom recovery boot to recovery and clear in recovery.
Woody
Sent from my SM-P600 using Tapatalk
Click to expand...
Click to collapse
I am using trials and errors way to detect faulty file by trying to delete few pdf files folders then restarting to check popping of "Unfortunately, IndexService has stopped" message, so after deleting few folder, that popping stop but I am not sure that problem is completely solved because battery consumption graph show that IndexService is still 2nd largest battery sucker after screen, so it must be running in background.
Sorry I'm still layment in terms of rooting & backup. But I did cleared all cache. Can you tell why I got this message- "Security policy restricts clearing off this app's cache" ? So not sure that it completely removed cache.
tspatil001 said:
I am using trials and errors way to detect faulty file by trying to delete few pdf files folders then restarting to check popping of "Unfortunately, IndexService has stopped" message, so after deleting few folder, that popping stop but I am not sure that problem is completely solved because battery consumption graph show that IndexService is still 2nd largest battery sucker after screen, so it must be running in background.
Sorry I'm still layment in terms of rooting & backup. But I did cleared all cache. Can you tell why I got this message- "Security policy restricts clearing off this app's cache" ? So not sure that it completely removed cache.
Click to expand...
Click to collapse
Im not sure unless knox is doing it. I had the same message so i cleared it in another program. I got 1.5gig back. Play has many programs that clear cache. Or you can use app section to clear chache on a app by app basis.
Good luck
Woody
When i got this message the anount of memory uaed by cache remained the same.
Sent from my SM-P600 using Tapatalk
There is no way to scan for the corrupt file, as far as I know. You'll just have to remove all files, and add back a few at a time, until the problem returns. http://forum.xda-developers.com/showthread.php?t=2483944
Sent from my SM-N900P
LMMT said:
There is no way to scan for the corrupt file, as far as I know. You'll just have to remove all files, and add back a few at a time, until the problem returns. http://forum.xda-developers.com/showthread.php?t=2483944
Sent from my SM-N900P
Click to expand...
Click to collapse
After removing some complex pdf of maths, "Unfortunately, IndexService has stopped." this message has stopped popping up, but battery drain & heat up is continuously building up. I have to keep it sleep or forced to keep it shut down.
for every ON 2 Mins= 1% battery discharge & 1 degree celsius rise in battery temperature.
What a weird problem is this! I got 20-50gb of academic pdfs which I was looking forward making it pdf library, not anymore due to this idiotic Index Service which scans each & every content of pdf to build its useless search index for every default Samsung app. & gets reset after every addition or deletion of file! Ridiculous Samsung. Pls issue update to make us able to disable/enable this service. Its extremely tedious to copy paste files by batch of 10-20 files with respect to my 50gb collection.
I seems I have no option than to do this cumbersome work.:crying:
I have attached few screen shot of my P601 scenario, please help guys, sure some one will come up with solution soon...:angel:
tspatil001 said:
After removing some complex pdf of maths, "Unfortunately, IndexService has stopped." this message has stopped popping up, but battery drain & heat up is continuously building up. I have to keep it sleep or forced to keep it shut down.
What a weird problem is this! I got 20-50gb of academic pdfs which I was looking forward making it pdf library, not anymore due to this idiotic Index Service which scans each & every content of pdf to build its useless search index for every default Samsung app. & gets reset after every addition or deletion of file! Ridiculous Samsung. Pls issue update to make us able to disable/enable this service. Its extremely tedious to copy paste files by batch of 10-20 files with respect to my 50gb collection.
I seems I have no option than to do this cumbersome work.:crying:
I have attached few screen shot of my P601 scenario, please help guys, sure some one will come up with solution soon...:angel:
Click to expand...
Click to collapse
Yes, it is ridiculous. I've seen it many times. My problem was was also a corrupt pdf. I copied the contents of my sd card to my computer, and formatted the card. I then added the files a few folders, at at time, until I found the culprit.
Sent from my SM-N900P
LMMT said:
Yes, it is ridiculous. I've seen it many times. My problem was was also a corrupt pdf. I copied the contents of my sd card to my computer, and formatted the card. I then added the files a few folders, at at time, until I found the culprit.
Sent from my SM-N900P
Click to expand...
Click to collapse
I think those pdf with illegible font like those mathematical formulas & Indian Devanagari/Sanskrit script is consider corrupt by Index service, which cause it to crash & stop. In crashing scenarios is better than letting Index service run, because it causes heat up & battery drain by letting it run. Where as "Unfortunately, IndexService has stopped." cause it to stop completely then no heat up & battery drain.
So may be temporary solution is to crash Index service to stop it as we I don't think there any other way to stop it without getting rooting.
What you think guys...?
tspatil001 said:
I think those pdf with illegible font like those mathematical formulas & Indian Devanagari/Sanskrit script is consider corrupt by Index service, which cause it to crash & stop. In crashing scenarios is better than letting Index service run, because it causes heat up & battery drain by letting it run. Where as "Unfortunately, IndexService has stopped." cause it to stop completely then no heat up & battery drain.
So may be temporary solution is to crash Index service to stop it as we I don't think there any other way to stop it without getting rooting.
What you think guys...?
Click to expand...
Click to collapse
To the best of my knowledge, rooting is the only way to disable the service (without intentionally crashing it).
Sent from my SM-N900P
LMMT said:
To the best of my knowledge, rooting is the only way to disable the service (without intentionally crashing it).
Sent from my SM-N900P
Click to expand...
Click to collapse
hmmm, let see what future awaits for Index Service...euthanasia or manslaughter...
lol...
I don't wana make my warranty void by rooting in now, may be in future.
Samsung aware of this rampage caused havoc on user by indexservice? Hope they should release update soon. May be Kitkat has solution.
tspatil001 said:
Some body please suggest solution to this indexing problem...
Click to expand...
Click to collapse
Look through the forums here for rooting instructions, then grab Titanium Backup and freeze index service, knox, sfinder and gallery. All your problems will go away!
Rich
Sent from my SM-P600 using XDA Premium 4 mobile app